1.

If all the classes use private inheritance in multilevel inheritance then ______________(a) It will not be called multilevel inheritance(b) Each class can access only non-private members of its parent(c) Each subsequent class can access all members of previous level parent classes(d) None of the members will be available to any other classI had been asked this question during an online exam.This intriguing question comes from Multilevel Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer»

The correct choice is (b) Each class can ACCESS only non-PRIVATE members of its parent

Best explanation: The CLASSES will be able to access only the non-private members of its parent class. The classes are using private inheritance, hence all the members of the parent class BECOME private in the derived class. In turn those won’t be allowed for further inheritance or DIRECT access outside the class.



Discussion

No Comment Found

Related InterviewSolutions