1.

If object of lowest level class is created (last derived class) ________________of its parent class constructors are called.(a) Few(b) All(c) Only parent and parent(d) Base and DerivedThis question was addressed to me in unit test.My question is from Hybrid Inheritance topic in division Inheritance & its Types of Object Oriented Programming

Answer»

Right choice is (c) Only parent and parent

Easiest explanation - When derived CLASS object is CREATED, all of its successor parent classes CONSTRUCTORS are called. CONSTRUCTOR of all the connected classes is not created. Since the parent MEMBERS have to be initialised, but other derived classes are not needed.



Discussion

No Comment Found

Related InterviewSolutions