A destructor as the name implies used to destroy the objects that have been created by constructor.
Like a constructor , the destructor is a member function whose name is same as class name but is preceded by tilde(~).
A destructor never takes any argument nor does it return nay value.
It will be invoked implicitly by compiler upon the exit from program or from a block or function.
Like a constructor , the destructor is a member function whose name is same as class name but is preceded by tilde(~).
A destructor never takes any argument nor does it return nay value.
It will be invoked implicitly by compiler upon the exit from program or from a block or function.
class integer
{
private: int m,n;
public:integer()
{
{
private: int m,n;
public:integer()
{
m=0,n=0;
}
~integer() //destructor
{
~integer() //destructor
{
}
};
Tags:
Cpp