[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'System' (#rtl)

TObject.Destroy

TObjectdestructor.

Declaration

Source position: objpash.inc line 123

public destructor TObject.Destroy; virtual;

Description

Destroyis the destructor of TObject. It will clean up the memory assigned to the instance. Descendent classes should override destroy if they want to do additional clean-up. No other destructor should be implemented.

It is bad programming practice to call Destroydirectly. It is better to call the Freemethod, because that one will check first if Selfis different from Nil.

To clean up an instance and reset the refence to the instance, it is best to use the FreeAndNilfunction.

See also

Create

  

TObjectConstructor

Free

  

Check for Niland call destructor.