1.

Which access specifiers should be used so that all the derived classes restrict further inheritance of base class members?(a) Private(b) Public(c) Protected(d) Any inheritance type can be usedThis question was addressed to me during an internship interview.The doubt is from Hierarchical Inheritance in division Inheritance & its Types of Object Oriented Programming

Answer»

The correct option is (a) Private

Explanation: All the DERIVED CLASSES must use private inheritance. This will make the members of base class private in derived classes. HENCE NONE of the members of base class will be AVAILABLE for further inheritance.



Discussion

No Comment Found

Related InterviewSolutions