RAD Studio
ContentsIndex
PreviousUpNext
Invoking Destructors

A destructor is called implicitly when a variable goes out of its declared scope. Destructors for local variables are called when the block they are declared in is no longer active. In the case of global variables, destructors are called as part of the exit procedure after the main function. 

When pointers to objects go out of scope, a destructor is not implicitly called. This means that the delete operator must be called to destroy such an object. 

Destructors are called in the exact opposite order from which their corresponding constructors were called (see Order of calling constructors).

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!