Order of Constructor/ Destructor Call in C++

In this tutorial, we will be discussing a program to understand the order of constructor/ destructor in C++.

Order of constructor/destructor refers to the pattern in which the constructors of various classes are called during inheritance of classes.

Example

 Live Demo

#include 
using namespace std;
//parent class
class Parent{
   public:
   Parent(){
      cout 

Output

Inside base class
Inside sub class
Updated on: 2020-04-14T12:04:57+05:30

616 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements