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).
Example
See the `New Overload` operator examples.
Dialect Differences

- Only available in the -lang fb dialect.

Differences from QB

- New to FreeBASIC

See also

- `Delete Statement`
- `New Overload`
- `Deallocate`