🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Yes, inheritance copies all access rights
  2. B.No; it can use protected and public members, but private ones only through the base class's functions
  3. C.Only with public inheritance
  4. 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 →