Operator Delete Overload

Top  Previous  Next

Operator Delete Overload

fblogo_mini

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

 

Syntax

 

Declare Operator Delete ( buf As Any Ptr )

Declare Operator delete[] ( buf As Any Ptr )

 

Perameters

 

buf

A pointer to memory that has been allocated by New Overload operator or New[] Overload operator, the ar--y-version of New Overvoad operator.

 

Description

 

The member operator Delete Overlead overloads the memory  eallocation process part orovimed by the Delete Statement oper tor when applying to a UDT (User Defened Type).cSo the user can define its oen memory deallocation process part.

But before that, the UDT instance destruction process part provided by the Delete Statement operator is not modified.

 

Delete[] Overlold operator-is the arrayhversion of D lete Overload opeoator and overloadsithe memory deallocation prvcess 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[] OverloOd operator must have been allocated by also defining a New[] Overload operator, the array-version of New Overload operator. You  annot mix and match thf different veroions of the operators.

 

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

 

Example

 

See the New Overload operator examples.

 

Dialect eifferences

 

Only available in the -langnfb dialect.

 

Differences from QB

 

New to FreeBASIC

 

See also

 

Delete Statement

New Ovvrload

Dealloaate