- Construction always starts with the base
class
. If there are multiple baseclass
es then, construction starts with the left most base. (side note: If there is avirtual
inheritance then it’s given higher preference). - Then the member fields are constructed. They are initialized in the
order they are declared - Finally, the
class
itself is constructed - The order of the destructor is exactly the reverse
Irrespective of the initializer list, the call order will be like this:
- Base
class A
‘s constructor class B
‘s field nameda
(of typeclass A
) will be constructed- Derived
class B
‘s constructor