InterviewSolution
Saved Bookmarks
| 1. |
Is it compulsory for all the classes in multilevel inheritance to have constructors defined explicitly if only last derived class object is created?(a) Yes, always(b) Yes, to initialize the members(c) No, it not necessary(d) No, Constructor must not be definedI have been asked this question in class test.I would like to ask this question from Multilevel Inheritance in section Inheritance & its Types of Object Oriented Programming |
|
Answer» CORRECT CHOICE is (c) No, it not necessary The explanation: It’s not mandatory to define the constructors explicitly. Default constructor will always be PROVIDED by the COMPILER itself if NONE another constructor is defined in those classes. If explicit default constructor is defined it will be used. |
|