32 Hierarchical Inheritance, Order of constructor execution in inheritance zoom | C++ Programming Tu

Опубликовано: 07 Март 2021
на канале: tech fort
89
1

#Hierarchical Inheritance:
A deriving more one than one class form single base base class.

#Order of Constructor Execution in Inheritance:
base class contructors are always called in the Derived class constructors, Whenever programmer/developer creates derived class object, Order: first base class 0-param(default) constructor will be executed and then derived class constuctor will proceed subsequently will finish the execution.

Note:

Whether derived/sub class 0-param(default) constructor is called or parameterized constructor is called, base class constructor is always be called inside of derived class constructor.

To call base/super class parameterized constructor inside the derived/child class parameterized constructor programmer must write/mention explicitly while declaring derived class parameterized constructor,

(Zero-param)Default constructor is present in all the classes

Bottom To Up : Constructor control calling (Sub to super)

Up to Bottom : Execution occures (Super to sub)