Skip to content

TObject

Base class of all classes.

Declaration

Source position: objpash.inc line 248

type

  TObject = class
  public
    const
      SystemHasExtendedRTTI = False;
    constructor Create;
    destructor Destroy;
    class function newinstance : TObject;
    procedure FreeInstance;
    function SafeCallException : HRESULT;
    procedure DefaultHandler;
    procedure Free;
    class function InitInstance : TObject;
    procedure CleanupInstance;
    class function ClassType : TClass;
    class function ClassInfo : pointer;
    class function ClassName : shortstring;
    class function ClassNameIs(const name: RTLString) : Boolean; overload;
    class function ClassNameIs(const name: ShortString) : Boolean;
    class function ClassParent : TClass;
    class function InstanceSize : SizeInt;
    class function InheritsFrom : Boolean;
    class function StringMessageTable : pstringmessagetable;
    class function MethodAddress : CodePointer;
    class function MethodName : shortstring;
    class procedure GetLastCastErrorInfo;
    function FieldAddress : pointer;
    procedure AfterConstruction;
    procedure BeforeDestruction;
    procedure DefaultHandlerStr;
    procedure Dispatch;
    procedure DispatchStr;
    function GetInterface(const iid: TGUID; out obj) : Boolean;
    function GetInterface(const iidstr: shortstring; out obj) : Boolean;
    function GetInterfaceByStr : Boolean;
    function GetInterfaceWeak : Boolean;
    class function GetInterfaceEntry : pinterfaceentry;
    class function GetInterfaceEntryByStr : pinterfaceentry;
    class function GetInterfaceTable : pinterfacetable;
    class function UnitName : RTLString;
    class function QualifiedClassName : RTLString;
    procedure DisposeOf;
    procedure CheckDisposed;
    function Equals : Boolean;
    function GetHashCode : PtrInt;
    function ToString : RTLString;
  end;

Inheritance

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).

Methods

Member Visibility Description
AfterConstruction public Method called after the constructor was called.
BeforeDestruction public Method called before the destructor is called.
CheckDisposed public
ClassInfo public Return a pointer to the type information for this class.
ClassName public Return the current class name.
ClassNameIs public Check whether the class name equals the given name.
ClassParent public Return the parent class.
ClassType public Return a "class of" pointer for the current class.
CleanupInstance public Finalize the class instance.
Create public TObject Constructor.
DefaultHandler public Default handler for integer message handlers.
DefaultHandlerStr public Default handler for string messages.
Destroy public TObject destructor.
Dispatch public Dispatch an integer message.
DispatchStr public Dispatch a string message.
DisposeOf public
Equals public Check if two objects are equal.
FieldAddress public Return the address of a field.
Free public Check for Nil and call destructor.
FreeInstance public Clean up instance and free the memory reserved for the instance.
GetHashCode public Return a hash code for the object.
GetInterface public Return a reference to an interface.
GetInterfaceByStr public Return an interface based on its GUID.
GetInterfaceEntry public Return the interface table entry by GUID.
GetInterfaceEntryByStr public Return the interface table entry by string.
GetInterfaceTable public Return a pointer to the table of implemented interfaces for a class.
GetInterfaceWeak public Get a reference to an interface, not increasing the reference count.
GetLastCastErrorInfo public
InheritsFrom public Check whether class is an ancestor.
InitInstance public Initialize a new class instance.
InstanceSize public Return the size of an instance.
MethodAddress public Return the address of a method.
MethodName public Return the name of a method.
newinstance public Allocate memory on the heap for a new instance.
QualifiedClassName public Fully qualified classname.
SafeCallException public Handle exception object.
StringMessageTable public Return a pointer to the string message table.
ToString public Return a string representation for the object.
UnitName public Unit name.

See also

Name Description
TClass Class of TObject.