I ran into an error yesterday and, while it\'s easy to get around, I wanted to make sure that I\'m understanding C++ right.
I have a base class with a protected memb
You can try with static_cast< const Derived*>(pBase)->Base::protected_member ...
class Base
{
protected:
int b;
public:
...
};
class Derived : public Base
{
protected:
int d;
public:
void DoSomething(const Base& that)
{
b += static_cast(&that)->Base::b;
d=0;
}
void DoSomething(const Base* that)
{
b += static_cast(that)->Base::b;
d=0;
}
};