1.

If all the classes used parameterized constructors and no default constructor then ___________(a) The object of lower level classes can’t be created(b) Object of lower level classes must call parent class constructors explicitly(c) Object of lower level classes must define all the default constructors(d) Only object of first class can be created, which is first parentThe question was asked in class test.Question is taken from Multilevel Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct answer is (b) Object of lower LEVEL classes must call parent class constructors explicitly

The best I can EXPLAIN: Each class constructor must be called before creating the object of any subclass. HENCE it will be mandatory to call the constructors of parent classes explicitly with parameters. This will make all the previous class MEMBER be initialized and then the class in use will be able to CREATE the object.



Discussion

No Comment Found

Related InterviewSolutions