Recall & Review
beginner
What are the three main access specifiers in C++ inheritance?
The three main access specifiers are <strong>public</strong>, <strong>protected</strong>, and <strong>private</strong>. They control how base class members are accessible in derived classes.Click to reveal answer
beginner
How does <code>public</code> inheritance affect access to base class members?With <code>public</code> inheritance, <code>public</code> members of the base class remain <code>public</code> in the derived class, and <code>protected</code> members remain <code>protected</code>. <code>private</code> members are not accessible directly.Click to reveal answer
intermediate
What happens to base class members when inherited with <code>protected</code> access?When inherited as <code>protected</code>, both <code>public</code> and <code>protected</code> members of the base class become <code>protected</code> in the derived class. <code>private</code> members remain inaccessible.Click to reveal answer
intermediate
Explain the effect of <code>private</code> inheritance on base class members.With <code>private</code> inheritance, all <code>public</code> and <code>protected</code> members of the base class become <code>private</code> in the derived class. <code>private</code> members remain inaccessible.Click to reveal answer
beginner
Can a derived class access the <code>private</code> members of its base class directly?No, <code>private</code> members of the base class are not accessible directly by the derived class, regardless of the type of inheritance.Click to reveal answer
In
public inheritance, what access level do public base class members have in the derived class?✗ Incorrect
In public inheritance, public members stay public in the derived class.
Which inheritance type makes all inherited base class members private in the derived class?
✗ Incorrect
Private inheritance converts all inherited public and protected members to private.
Can a derived class access the private members of its base class directly?
✗ Incorrect
Private members are never accessible directly by derived classes.
In protected inheritance, what happens to public members of the base class?
✗ Incorrect
Public members become protected in protected inheritance.
Which access specifier allows derived classes to access base class members but prevents outside access?
✗ Incorrect
Protected members are accessible to derived classes but not outside code.
Describe how public, protected, and private inheritance affect the accessibility of base class members in a derived class.
Think about how each inheritance type changes the access level of base class members.
You got /4 concepts.
Explain why private members of a base class are not accessible in derived classes, regardless of inheritance type.
Consider the purpose of private access in object-oriented design.
You got /3 concepts.