Order of Execution of Constructors and Destructors in Inheritance in C++

  c++

Email

#include<iostream>

using namespace std;

class Anil{
public :

Anil()
{
cout << “this coding constracteer of the base class”;
}
~ Anil(){

cout << “this Discter of the basce class”;
}

};
class Book : public Anil{

public :

Book(){
cout << “this coding is them main constear codng”;

}
~Book(){
cout << “this coding if the Destrucer of the coding”;
}
};

int main(){

Book naik;

}

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of