If a class is declared to be a base class for another class using the protected access specifier, the public and protected members of the base class are accessible as protected members of the derived class.
你看的书不会有翻译错误吧
class A
{
protected:
int a;
};
class B:protected A
{
};
class C :protected B
{
public:
void fun()
{
a = 520;
cout << "a=" << a << endl;
}
};
int main(void)
{
C c;
c.fun();
return 0;
}
//c=520