TObject



TObject

Hierarchy
The base class type that is ancestor to all other classes

Description

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.

static methods
Property-icon.png ClassName
Property-icon.png ClassParent
Property-icon.png ClassType
Object Methods
Method-icon.png Create
Method-icon.png Free
Method-icon.png Destroy

Static Methods

Property-icon.png ClassName

Gives the class name as a string.

Property-icon.png ClassParent

Gives the class parent name.

Property-icon.png ClassType

Gives class type name as TClass.


Object Methods

Method-icon.png Create

Empty object creator.

Method-icon.png Free

Calls Destroy for a non-nil object ref.

Method-icon.png Destroy

Releases object storage.


TObject for Delphi Web Script

In traditional Object Pascal all classes inherit from a root type called TObject. This was also the case for Delphi Web Script, from which Smart Pascal evolved. In order to better be able to import classes written in Javascript - which is extremely important with regards to having full support for the DOM (document object model) and the full spectrum of JavaScript modules - dependency on TObject as the root of all class types had to be altered. See for instance, TVariant in the example bellow:

 Simple example