Glossary: Destructor

Objects are complete, miniature programs and, like any good programs, have well defined initialisation and termination phases. They have special routines (i.e. member functions ) to look after this. The termination routine is called the destructor, and C++ will provide a default if none is supplied. If, during the lifetime of the object, it uses heap memory then the designer of the object must provide a destructor function to release such memory to avoid a memory leak.

The initialisation routine is called the constructor.


See OO Concepts: Constructors & Destructors
Go Back to the The Glossary Top Page


If you have any comments about this page please send them to Nick West