delphirtl • Docs
delphirtl / TObject
Implements Delphi TObject semantics where you have to call .Free() to destroy the object. Has AfterConstruction and BeforeDestruction methods, which can be overridden.
new TObject():
TObject
AfterConstruction():
void
Responds after the last constructor has executed.
AfterConstruction is called automatically after the object’s last constructor has executed. Do not call it explicitly in your applications.
The AfterConstruction method implemented in TObject does nothing. Override this method when creating a class that performs an action after the object is created.
void
BeforeDestruction():
void
Responds before the first destructor executes.
BeforeDestruction is called automatically before the object’s first destructor executes. Do not call it explicitly in your applications.
The BeforeDestruction method implemented in TObject does nothing. Override this method when creating a class that performs an action before the object is destroyed.
void
destroy():
void
performs cleanup tasks and destroys the object
void
Destroy():
void
void
free():
void
Calls destroy to perform any cleanup tasks. Call Free() to destroy the object, so as to retain Delphi-style AfterConstruction and BeforeDestruction semantics.
void
Free():
void
Destroys the object, maintaining Delphi-style AfterConstruction and BeforeDestruction semantics.
void
static
Create<T
>(this
, …args
):T
Creates a new instance of the class. To create a new constructor, declare the constructor(args) method and call the super constructor. Then, to instantiate the class, call YourClass.Create(args) instead of new YourClass(args), so as to retain Delphi-style AfterConstruction and BeforeDestruction semantics.
• T extends TObject
<T
>
• this
• …args: any
[]
T