If the protected members are to be made accessible only to the nearest subclass and no further subclasses, which access specifier should be used in inheritance?

If the protected members are to be made accessible only to the nearest subclass and no further subclasses, which access specifier should be used in inheritance? Correct Answer The sub class should inherit the parent class privately

The sub class should use private inheritance. This will allow only the nearest sub classes to inherit the protected members and then those members will become private. Hence further inheritance of those members will not be possible.
Bissoy MCQ

Related Questions