RAD Studio |  |

Destructors
See Also
Collapse All

The destructor for a class is called to free members of an object before the object is itself destroyed. The destructor is a member function whose name is that of the class preceded by a tilde (~). A destructor cannot accept any parameters, nor will it have a return type or value declared.

Copy Code

    #include <stdlib.h>
    class X
    {
    public:
       ~X(){};  // destructor for class X
    };

If a destructor isn’t explicitly defined for a class, the compiler generates one.

See Also

Class Initialization

Invoking Destructors

Atexit

Exit And Destructors

abort And Destructors

Virtual Destructors

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