Не уверен, что я правильно понял ваш вопрос ....
class A {
public:
int nValueA;
protected:
int nValueB;
private:
int nValueC;
};
class B : public A {
public:
B();
int x, y, z;
};
B::B():
x(nValueA), //-->OK
y(nValueB), //-->OK
z(nValueC) //-->error due to child can't inherit parent's private member
{}
void main(){
B object;
object.nValueA = 888; //--> valid
object.nValueB = 888; //--> error since protected member is not accessible
object.nValueC = 888; //--> error since private member is not accessible
}
Возможное решение:
class A {
public:
int nValueA;
int nValueB;
int nValueC;
};