A destructor method called just prior to an object's final destruction by the garbage collector.
A destructor can be used to ensure that an object terminates cleanly.
Destructors have this general form:
~class-name( ) {
// destruction code
}
class-name is the name of the class.