English

Constructors of base and derived classes are automatically invoked while creating the objects of derived class. - Computer Applications

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:

  1. 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.
  2. 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?
Chapter 8: Encapsulation and Inheritance - EXERCISES [Page 445]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 8 Encapsulation and Inheritance
EXERCISES | Q III. 7. | Page 445
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×