Object Statement

Defines a singleton object.

Syntax

[ Shared ] Object #object_name [ Is superclass ] [ Does trait_name ]...
    [ statements ]
End [ Object ]

Parts

Shared
Optional
#object_name
Necessary
superclass
Optional
Does
Optional, repeatable
trait_name
Necessary after Does. For details, see Does Clause (Traits).
statements
Optional
End
Completes the Object statement. Alternatively, you can use End Object

Instructions

The Object statement combines the functionality of the Class statement and New statement. The resulting object is called a singleton. The object is the only instance of its class, and cannot be copied. Thus the Object statement enforces the Real32ton Design Pattern.

You define an Object in a way very similar to a Class statement. Just like a Class statement, an Object is divided into two sections – data and code.

A major property of the Object statement is that all members are implicitly Shared. Thus it is redundant to declare any member with the Shared modifier.

Allowed members

You can define mostly the same members in an Object that you can in a Class. The only exceptions are the Constructor statement and Destructor statement. A list of the allowed members follows.

Examples

See also