Object Statement

Defines a singleton object.


[ @Shared ] Object #name [ Is class_name ] [ Does trait_name ]…
    [ statements ]
End [ Object ]


Optional modifier specifies that the object can have a small scope, but its lifetime continues until the program completes.
Mandatory name for the object.
Optional name of a class from which the object inherits methods and properties.
Optional keyword that you can use again and again.
Mandatory after Does. See Does Clause (Traits) for more information.
Optional declarations and executable statements.
Completes the statement. You can also use End Object
You can change this part of the syntax. See @Option Directive for more information.


Object operates almost the same as Class and New put together. The result is an object called a singleton. The object is the only instance of its class, and you cannot make a copy of it.

You define an object almost the same as a class. It is divided into two parts – data and code.

All members of an object are shared. Thus it is not necessary to declare a member with @Shared.

Permitted members

You can define most of the same members in Object that you can in Class. But you cannot use Constructor and Destructor. A list of permitted members follows.



See also