Parent Previous Next


A class is defined as a custom type. In its very essence it has a name and a code block like this:

Class TCustomType



A class has member fields and functions - all defined by the programmer. Each member has access modifiers to specify public or private access to the member.

Class TCustomType


 Public  Integer  MyField;

 Private Function MyFunction() : Integer { }


If a member does not have an access identifier, then it is private.

Standard Functionality.

In addition to any member functions made by the programmer, a class also has a number of predefined standard functions included. Each standard function of the class type is described individually in the next pages - e.g. including the most important standard function Class.New.

Classes are used as reference based objects. In order to use a class, you must declare a variable of the class type and instantiate the variable using the .New() function:


   TCustomType myVar;  //Declare variable.

   myVar.New();        //Instantiate new object.

   myVar.MyField := 1; //Use object members.

   myVar.SetNull();    //No longer point to the object.


A class variable initially is Null and points to nothing in memory until it is instantiated with the .New() function, at which an object of the class is created in memory, and the variable then refers/points to the object and can use the object to store the data of the variable.

When using the standard function  .SetNull()  the variable looses the reference to the object and now refers to nothing - it points to Null. The object however still exists in memory and the object still has the data field MyField assigned to 1.

An object can be referenced by multiple variables - e.g. two variables of the same type can be assigned like  ObjA := ObjB  and will now refer to the same object data in memory. If however both variables are assigned to a new object, then the old object is no longer referenced by any of them, and the object data is inaccessible.

If an object exists in memory, but not a single living variable refers to it, then the object and the memory used by the object can be deleted/recycled by the programmer by invoking a call in the code to the garbage collection functionality.

Working With Class Objects.

These operators can be used for classes:




x.y   foo(x)


==   <>



The equality operators checks whether the operands are Null or refers to the same object in memory:


   Boolean b;

   TCustomType objA, objB; //Both are Null.

   b := objA == objB;  //Now b == True.


   b := objA == objB;  //Now b == False.

   objA := objB;

   b := objA == objB;  //Now b == True.


Operands can be checked for Null using the Class.IsNull function in the expressions.

The Main Class.

Each project must contain the Main class, which contains the Main function, which constitutes the entry point of bytecode execution.

The Main class is a special class, which can't be used as a type and can't be instantiated.