Saved Bookmarks
| 1. |
Which class constructor is called first when an object of derived class is created?(a) Base class constructor(b) Derived class constructor(c) Firstly created derived class constructor(d) Last created derived class constructorThe question was asked in an internship interview.This intriguing question originated from Hierarchical Inheritance topic in division Inheritance & its Types of Object Oriented Programming |
|
Answer» RIGHT option is (a) Base class constructor Easiest explanation - The base class must be initialised FIRST hence the constructor of base class is CALLED first. This makes everything ready for the new object being CREATED. |
|