The base class type that is ancestor to all other classes System unit
type TObject = class
  constructor Create;
  destructor Destroy; virtual;
The TObject type defines the base class type. It is the oldest grandparent of all classes - every class is ultimately derived from TObject.
Because of this, every object inherits the methods of TObject.
The TObject methods fall into two categories - class and non-class. When prefixed by the keyword Class, a method may be called in both an object of the class, and in the class itself. Such a static method cannot access any class fields because a class has no data itself - only instantiated classes - objects - have data.
Some key Class (static) methods:
function ClassName  Gives the class name as a string
ClassParent  Gives the class parent name
ClassInfo  Gives class Run Time info
InstanceSize  Size of class object in bytes
NewInstance  Creates a new class object

Some key Object methods:
Create  Empty object creator
Free  Calls Destroy for a non-nil object ref
Destroy  Releases object storage
AfterConstruction  Called after construction
BeforeDestruction  Called before destruction
Related commands
ClassStarts the declaration of a type of object class
PrinterReturns a reference to the global Printer object
 Download this web site as a Windows program.

Example code : Using TObject methods inherited in a TForm subclass
  // The unit form was derived from TObject.
  // So we can use methods of TObject:
  ShowMessage('Form1 object class name = '+
  ShowMessage('Form1 object class parent name = '+
  ShowMessage('Form1 object instance size = '+

  // And now on TObject itself
  ShowMessage('TObject class name = '+
  ShowMessage('TObject instance size = '+
Show full unit code
  Form1 object class name = TForm1
  Form1 object parent class name = TForm
  Form1 object instance size = 764
  TObject class name = TObject
  TObject instance size = 4
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page