Constructors and destructors in C++

A constructor is called to create an object and a destructor is called to destroy one. For a local object execution of constructor function is done when object is declared and execution of a destructor function is done when object is destroyed. For global objects constructers functions are executed before the main () function. Constructors which are global are executed in order of their declaration. Global destructor functions are executed after the main() function is over.

Leave a Reply