#include <iostream.h>
#include<conio.h>
class myclass
{
int a;
public:
myclass();
~myclass();
void show();
};
myclass::myclass()
{
cout<< "In constructor\n";
a =10;
}
myclass::~myclass() // destructor defined
{
cout<< "Destructing ...\n";
}
void myclass::show()
{
cout << a << endl;
}
void main()
{
clrscr();
myclass ob;
ob.show();
getch();
}
Output:
In constructor
10