1.

Is it compulsory to have constructor for all the classes involved in multiple inheritance?(a) Yes, always(b) Yes, only if no abstract class is involved(c) No, only classes being used should have a constructor(d) No, they must not contain constructorsThe question was posed to me in a national level competition.I'm obligated to ask this question of Multiple Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

Correct ANSWER is (b) Yes, only if no abstract class is involved

Explanation: The constructors must be DEFINED in every class. If class is abstract, it won’t have any CONSTRUCTOR but other CLASSES must have constructor. Either IMPLICIT or explicit.



Discussion

No Comment Found

Related InterviewSolutions