Advertisements
Advertisements
Question
Constructors of base and derived classes are automatically invoked while creating the objects of derived class.
Options
True
False
MCQ
True or False
Solution
This statement is True.
Explanation:
- When you create an object of a derived class (also known as a child class) in inheritance, the base class (parent class) constructor is automatically called first, followed by the derived class constructor.
- This occurs because the derived class inherits the properties of the base class, and the base class must be properly initialized before the derived class may access its members.
shaalaa.com
Is there an error in this question or solution?