Runtime Type Identification And Destructors

From RAD Studio
Jump to: navigation, search

Go Up to The Typeid Operator 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 runtime type identification enabled. The runtime 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
}
Personal tools
Newest Version: XE
In other languages