English
Tamil Nadu Board of Secondary EducationHSC Science Class 11

Write some facts about the execution of constructors and destructors in inheritance? - Computer Science

Advertisements
Advertisements

Question

Write some facts about the execution of constructors and destructors in inheritance?

Short Note

Solution

  1. Base class constructors are executed first, before the derived class constructor's execution.
  2. A derived class cannot inherit the base class constructor but it can call the base class constructor by using Base_class name: :base_class_constructor() in the derived class definition
  3. If there are multiple base classes, then it starts executing from the leftmost base class
  4. In multilevel inheritance, the constructors will be executed in the order of inheritance The destructors are executed in the reverse order of inheritance.
shaalaa.com
  Is there an error in this question or solution?
Chapter 16: Inheritance - Evaluation - Section - C [Page 273]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 11 TN Board
Chapter 16 Inheritance
Evaluation - Section - C | Q 5. | Page 273
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×