#include<iostream>
using namespace std;
class TestDestructor
{
int *t;
public:
TestDestructor()
{
t = new int;
}
void accept()
{
cout<<"\n Enter Number : ";
cin>>*t;
}
void display()
{
cout<<"\n Entered Number is : "<<*t;
}
∼ TestDestructor() //Automatically called after the end of the execution.
{
delete t;
cout<<"\n\n Destroyed ";
}
};
int main()
{
TestDestructor td;
td.accept();
td.display();
return 0;
}