All inherit from base object class:
Code: Select all
;{-Base Class
;-Base Class
Interface Object
Free()
EndInterface
Structure _ObjectData
*vt
EndStructure
Structure _ObjectMethods
Free.i
EndStructure
Global _ObjectMethods._ObjectMethods
Procedure _ObjectFree(*This._ObjectData)
;Protected *methods.Object = *This
FreeStructure(*This)
EndProcedure
Procedure NewObject(*Data._ObjectData = 0)
Protected *methods._ObjectMethods
If *Data = 0: *Data = AllocateStructure(_ObjectData): EndIf
If *Data\vt = 0: *Data\vt = _ObjectMethods: EndIf
*methods = *Data\vt
With *methods
If \Free = 0: \Free = @_ObjectFree(): EndIf
EndWith
With *Data
\vt = *methods
EndWith
ProcedureReturn *Data
EndProcedure
Macro FreeAndNull(_Data)
If _Data <> 0: _Data\Free(): _Data = 0: EndIf
EndMacro
;}