Run-Time Type Identification And Destructors

From RAD Studio
Jump to: navigation, search

Go Up to Run-Time Type Identification (RTTI) Index


When destructor cleanup is enabled, a pointer to a class with a virtual destructor can't be deleted if that class is not compiled with run-time type identification enabled. The run-time type identification and destructor cleanup options are on by default. They can be disabled from the C++ page of the Project Options dialog box, or by using the -xd and -RT command-line options.

Example

 class Alpha {
 public:
    virtual ~Alpha() {
    }
 };
 
 void func(Alpha *Aptr) {
    delete Aptr; // Error.  Alpha is not a polymorphic class type
 }

See Also