1.

If there are 5 classes, E is derived from D, D from C, C from B and B from A. Which class constructor will be called first if the object of E or D is created?(a) A(b) B(c) C(d) A and BThis question was posed to me in an online quiz.My doubt stems from Multilevel Inheritance in portion Inheritance & its Types of Object Oriented Programming

Answer» RIGHT choice is (a) A

For EXPLANATION: A is PARENT of all other classes indirectly. Since A is parent of B and B is parent of C and so on till E. Class A CONSTRUCTOR will be called first always.


Discussion

No Comment Found

Related InterviewSolutions