Which of the following is not true in case of public inheritance in C++?

2018

Which of the following is not true in case of public inheritance in C++?

  1. A.

    Each public member in the base class is public in the derived class.

  2. B.

    Each protected member in the base class is protected in the derived class

  3. C.

    Each private member in the base class remains private in the base class.

  4. D.

    Each private member in the base class remains private in the derived class.

Attempted by 159 students.

Show answer & explanation

Correct answer: D

Concept: access rules under public inheritance

When a class is derived using public inheritance, each base-class member keeps its original access level in the derived class, with one exception: a base class's private members are never accessible to the derived class at all, under any inheritance mode. They are not inherited as private (or any other) members of the derived class — they simply remain usable only inside the base class.

Application: checking each statement against the rule

  • A public member of the base class stays public in the derived class — this matches the rule, so it is true.

  • A protected member of the base class stays protected in the derived class (usable by the derived class's own code, not by outside code) — this matches the rule, so it is true.

  • A private member of the base class stays private to the base class itself — this is simply what 'private' means for the base class, independent of any inheritance; it is true.

  • A private member of the base class becoming private in the derived class — this contradicts the rule, because base-class private members are never accessible to (or inherited by) the derived class in any form.

Cross-check: the two easily-confused private-member statements

  • “Remains private in the base class” describes the member staying inside its own base class — a fact about the base class alone, unrelated to inheritance, and always true.

  • “Remains private in the derived class” claims the member becomes part of the derived class (as a private member) — this is what public (and every) inheritance mode explicitly denies, since private base members are inaccessible to derived classes.

So the statement claiming that a base class's private member remains private in the derived class is the one that is NOT true — that is the statement being asked for.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs