R
rmilh
As you can see in this example the coder did't think it is necessary
to have an instance of a Derived to be able to set Base member prot.
Is it legal?
class Base
{
protected:
int prot;
};
class Derived : public Base
{
public:
using Base:rot;
};
int main()
{
Base base;
//instance of derived not needed to access protected member?
static_cast<Derived&>(base).prot = 1;
return 0;
}
Robert Milharcic
to have an instance of a Derived to be able to set Base member prot.
Is it legal?
class Base
{
protected:
int prot;
};
class Derived : public Base
{
public:
using Base:rot;
};
int main()
{
Base base;
//instance of derived not needed to access protected member?
static_cast<Derived&>(base).prot = 1;
return 0;
}
Robert Milharcic