← Quiz: Inheritance and Virtual Functions: all 10 questions
Quiz: Inheritance and Virtual Functions · Question 7 of 10
Can a derived class access the private members of its base class directly?
Can a derived class access the private members of its base class directly?
- A.Yes, inheritance copies all access rights
- B.No; it can use protected and public members, but private ones only through the base class's functions
- C.Only with public inheritance
- D.Only in the derived class's constructor
Answer & explanation
Correct answer: No; it can use protected and public members, but private ones only through the base class's functions
private means private to that class; protected is the level meant for derived classes.
Can you get the rest right without peeking?
Take the timed Quiz: Inheritance and Virtual Functions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →