Operator Delete Overload


Member operator to overload memory deallocation process part provided by Operator Delete Statement when applying to a UDT (User Defined Type).

Syntax:
declare operator delete ( buf as any ptr )
declare operator delete[] ( buf as any ptr )

Parameters:
buf
A pointer to memory that has been allocated by New Overload operator or New[] Overload operator, the array-version of New Overload operator.

Description:
The member operator Delete Overload overloads the memory deallocation process part provided by the Delete Statement operator when applying to a UDT (User Defined Type). So the user can define its own memory deallocation process part.
But before that, the UDT instance destruction process part provided by the Delete Statement operator is not modified.

Delete[] Overload operator is the array-version of Delete Overload operator and overloads the memory deallocation process provided by the Delete[] Statement operator when applying to a UDT (User Defined Type).

Memory freed with Delete Overload operator must have be allocated by also defining a New Overload operator. Memory freed with Delete[] Overload operator must have been allocated by also defining a New[] Overload operator, the array-version of New Overload operator. You cannot mix and match the different versions of the operators.

Member operators Delete Overload, and Delete[] Overload are always static, even if not explicitly declared (static keyword is unnecessary but allowed). Thus, they do not have an implicit This instance argument passed to them (because instance already been destroyed).

Examples:
See the New Overload operator examples.

Dialect Differences:
Differences from QB:
See also:
Back to Memory Operators
Back to Operators
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode