Advertisement



< Prev
Next >



C++ Destructor





In C++, a constructor is a special member function of a class which is used to create and initialize its objects. A destructor is also a special member function, but contrary to the working of a constructor, a destructor is used to destroy the objects of a class and to clean up their storage space, because let's say, these objects are no longer required and accessible.



Some important features of a destructor 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




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement