TObject
[Properties (by Name)][Methods (by Name)][Events (by Name)]
Base class of all classes.
Declaration
Source position: objpash.inc line 203
Type
TObject = class
public
constructor Create;
destructor Destroy; Virtual;
class function newinstance : TObject; Virtual;
procedure FreeInstance; Virtual;
function SafeCallException(exceptobject: TObject;
exceptaddr: CodePointer) : HRESULT; Virtual;
procedure DefaultHandler(var message); Virtual;
procedure Free;
class function InitInstance(instance: pointer) : TObject;
procedure CleanupInstance;
class function ClassType : TClass;
class function ClassInfo : pointer;
class function ClassName : shortstring;
class function ClassNameIs(const name: string) : Boolean;
class function ClassParent : TClass;
class function InstanceSize : SizeInt;
class function InheritsFrom(aclass: TClass) : Boolean;
class function StringMessageTable : pstringmessagetable;
class function MethodAddress(const name: shortstring) : CodePointer;
class function MethodName(address: CodePointer) : shortstring;
function FieldAddress(const name: shortstring) : pointer;
procedure AfterConstruction; Virtual;
procedure BeforeDestruction; Virtual;
procedure DefaultHandlerStr(var message); Virtual;
procedure Dispatch(var message); Virtual;
procedure DispatchStr(var message); Virtual;
function GetInterface(const iid: TGuid; out obj) : Boolean;
function GetInterface(const iidstr: shortstring; out obj) : Boolean;
function GetInterfaceByStr(const iidstr: shortstring; out obj) : Boolean;
function GetInterfaceWeak(const iid: TGuid; out obj) : Boolean;
class function GetInterfaceEntry(const iid: TGuid) : pinterfaceentry;
class function GetInterfaceEntryByStr(const iidstr: shortstring)
: pinterfaceentry;
class function GetInterfaceTable : pinterfacetable;
class function UnitName : ansistring;
class function QualifiedClassName : ansistring;
function Equals(Obj: TObject) : Boolean; Virtual;
function GetHashCode : PtrInt; Virtual;
function ToString : ansistring; Virtual;
end
;
Description
TObject is the parent root class for all classes in Object Pascal. If a class has no parent class explicitly declared, it is dependent on TObject. TObject introduces class methods that deal with the class' type information, and contains all necessary methods to create an instance at runtime, and to dispatch messages to the correct method (both string and integer messages).
Members
Member | Type | Visibility | Description |
---|---|---|---|
AfterConstruction | Method | public | Method called after the constructor was called. |
BeforeDestruction | Method | public | Method called before the destructor is called. |
ClassInfo | Method | public | Return a pointer to the type information for this class. |
ClassName | Method | public | Return the current class name. |
ClassNameIs | Method | public | Check whether the class name equals the given name. |
ClassParent | Method | public | Return the parent class. |
ClassType | Method | public | Return a "class of" pointer for the current class |
CleanupInstance | Method | public | Finalize the class instance. |
Create | Method | public | TObject Constructor |
DefaultHandler | Method | public | Default handler for integer message handlers. |
DefaultHandlerStr | Method | public | Default handler for string messages. |
Destroy | Method | public | TObject destructor. |
Dispatch | Method | public | Dispatch an integer message |
DispatchStr | Method | public | Dispatch a string message. |
Equals | Method | public | Check if two objects are equal. |
FieldAddress | Method | public | Return the address of a field. |
Free | Method | public | Check for Nil and call destructor. |
FreeInstance | Method | public | Clean up instance and free the memory reserved for the instance. |
GetHashCode | Method | public | Return a hash code for the object |
GetInterface | Method | public | Return a reference to an interface |
GetInterfaceByStr | Method | public | Return an interface based on its GUID |
GetInterfaceEntry | Method | public | Return the interface table entry by GUID |
GetInterfaceEntryByStr | Method | public | Return the interface table entry by string |
GetInterfaceTable | Method | public | Return a pointer to the table of implemented interfaces for a class |
GetInterfaceWeak | Method | public | Get a reference to an interface, not increasing the reference count |
InheritsFrom | Method | public | Check whether class is an ancestor. |
InitInstance | Method | public | Initialize a new class instance. |
InstanceSize | Method | public | Return the size of an instance. |
MethodAddress | Method | public | Return the address of a method |
MethodName | Method | public | Return the name of a method. |
newinstance | Method | public | Allocate memory on the heap for a new instance |
QualifiedClassName | Method | public | Fully qualified classname |
SafeCallException | Method | public | Handle exception object |
StringMessageTable | Method | public | Return a pointer to the string message table. |
ToString | Method | public | Return a string representation for the object |
UnitName | Method | public | Unit name |
Inheritance
Class | Description |
---|---|
TObject | Base class of all classes. |
See also
Name | Description |
---|---|
TClass | Class of TObject . |