A constructor is a class method that is automatically called when an instance of the class is instantiated. The purpose of the constructor is to set up the new instance. A destructor is a method that is called when an instance of the class is destroyed. The purpose of the destructor is to clean up just prior to the class being deleted. Typically this includes freeing memory pointed to by instance data. Some programming languages support special constructors called "copy constructors" which are called when an instance is created as a copy of another instance.
+
A constructor is a class method that is automatically called when an instance of the class is instantiated. The purpose of the constructor is to set up the new instance. A destructor is a method that is called when an instance of the class is destroyed. The purpose of the destructor is to clean up just prior to the instance being deleted. Typically this includes freeing memory pointed to by instance data. Some programming languages support special constructors called "copy constructors" which are called when an instance is created as a copy of another instance.