Show: Delphi C++
Display Preferences

Invoking Destructors

From RAD Studio
Jump to: navigation, search

Go Up to Destructors Index

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).

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance