< Prev
Next >

C++ Destructor

In C++, a constructor is a special member function of class which is used to create and initialize its objects. Contrary to the working of a constructor, a destructor is also a special member function of a class, used to destroy the object of a class and to clean up its storage space, because this object is no longer accessible which were created by the constructor.

Some important features of a constructor are -

When a destructor is called?

A destructor is automatically called by the compiler when a program ends its execution or as soon as the closing brace } of a block or a function is encountered, and in this case the compiler calls the destructor which destroys all the objects created within that particular block/function.

Please Subscribe

Please subscribe to our social media channels for daily updates.

Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page



Please check our latest addition