RAD Studio |  |

Overloading The Operator delete
See Also
Collapse All

The global operators, ::operator delete(), and ::operator delete[]() cannot be overloaded. However, you can override the default version of each of these operators with your own implementation. Only one instance of the each global delete function can exist in the program.

The user-defined operator delete must have a void return type and void* as its first argument; a second argument of type size_t is optional. A class T can define at most one version of each of T::operator delete[]() and T::operator delete(). To overload the delete operators, use the following prototypes.

- void operator delete(void *Type_ptr, [size_t Type_size]); // For Non-array
- void operator delete[](size_t Type_ptr, [size_t Type_size]); // For arrays

See Also

The keyword delete

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