Ace Your C++ Skills 2025 – Rock the ‘Thinking in C++’ Challenge!

Question: 1 / 565

What must be added before a base class in an inheritance declaration to keep its public members public in the derived class?

public

In object-oriented programming, inheritance allows for the creation of new classes that inherit traits and behaviors from a parent or base class. When a base class's public members need to be accessible in a derived class, the keyword "public" must be added before the base class in the inheritance declaration. This makes sure that the public members remain accessible in the derived class. The other options, "private", "protected", and "internal", all restrict access to the public members and thus would not maintain their public accessibility in the derived class.

Get further explanation with Examzify DeepDiveBeta

private

protected

internal

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy