V
vDave420
I feel stupid, because I can't figure out why this shouldn't work.
I am getting this error using MS VS6 sp5 i believe.
Is this correct?
-----------------
namespace Test
{
class Base
{
protected:
virtual void DoSomething( void )=0;
};
class Der : public Base
{
public:
void CallDoSomething( Base *base );
protected:
virtual void DoSomething( void );
};
}
using namespace Test;
void Der:oSomething( void )
{}
void Der::CallDoSomething( Base *base )
{
Base *This=(Base*)this;
base->DoSomething(); // Gives "error C2248: 'DoSomething' : cannot
access protected member declared in class 'Test::Base'"
this->DoSomething(); // Works fine (calls Der:oSomething() though)
This->DoSomething(); // Gives "error C2248: 'DoSomething' : cannot
access protected member declared in class 'Test::Base'"
}
-----------------
I don't want to have to assume that a Base* is a Der* to be able to
call Base:oSomething from inside of Der::CallDoSomething.
I thought that public inheritence ( class Der : public Base ) would do
it.
Any ideas?
Thanks in advance.
-dave-
I am getting this error using MS VS6 sp5 i believe.
Is this correct?
-----------------
namespace Test
{
class Base
{
protected:
virtual void DoSomething( void )=0;
};
class Der : public Base
{
public:
void CallDoSomething( Base *base );
protected:
virtual void DoSomething( void );
};
}
using namespace Test;
void Der:oSomething( void )
{}
void Der::CallDoSomething( Base *base )
{
Base *This=(Base*)this;
base->DoSomething(); // Gives "error C2248: 'DoSomething' : cannot
access protected member declared in class 'Test::Base'"
this->DoSomething(); // Works fine (calls Der:oSomething() though)
This->DoSomething(); // Gives "error C2248: 'DoSomething' : cannot
access protected member declared in class 'Test::Base'"
}
-----------------
I don't want to have to assume that a Base* is a Der* to be able to
call Base:oSomething from inside of Der::CallDoSomething.
I thought that public inheritence ( class Der : public Base ) would do
it.
Any ideas?
Thanks in advance.
-dave-