Which inheritance access mode makes public and protected members of the base class remain public and protected in the derived class?

Options

  • A. Private inheritance
  • B. Protected inheritance
  • C. Public inheritance
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. Public inheritance

Detailed Explanation

Answer: Public inheritance

With public inheritance, public members of the base class remain public in the derived class, while protected members remain protected.

Private members of the base class are not directly accessible in the derived class.

This is the commonly used inheritance mode when the derived class represents an "is-a" relationship with the base class.