here is one of the questions from my assignment.
I don't know the answer, but I think y is protected.
Can anyone confirm the answer and give me a way to test this?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Variable "y" in class Y, will be...
class X {
private: int x;
protected: int y;
public: int z;
};
class Y : protected X {
};
Select correct answer (single choice)
private
none of these
protectedpublic
Yes it is protected ; since the variable y was protected In class x and inherited as protected.
The answer is yes : y is protected , you are guessing right. Good Luck, Zaki