Can you please explain Explain constructors and destructors?

Submitted by: Administrator
Constructors are the member functions of the class that executes automatically whenever an object is created. Constructors have the same name as the class. Constructors initialize the class. Constructors can't have return type. Destructors are called when the objects are destroyed.

Destructors are usually used to deallocate memory and do other cleanup for a class object and its class members when the object is destroyed. A destructor is called for a class object when that object passes out of scope or is explicitly deleted. A destructor takes no arguments and has no return type.
Submitted by: Administrator

Read Online C++ Constructors Job Interview Questions And Answers