A
avasilev
Hi all,
Quick question: why doesn't this code compile:
class Base
{
protected:
int a;
};
class Derived: public Base
{
public:
void test(Base* b)
{
b->a = 5;
}
};
int main()
{
Derived d;
Derived d1;
d.test(&d1);
}
The error is that Base::a is protected in the test() method of Derived
Thanks in advance
Best regards
Alex
Quick question: why doesn't this code compile:
class Base
{
protected:
int a;
};
class Derived: public Base
{
public:
void test(Base* b)
{
b->a = 5;
}
};
int main()
{
Derived d;
Derived d1;
d.test(&d1);
}
The error is that Base::a is protected in the test() method of Derived
Thanks in advance
Best regards
Alex