Makes a singleton object.
[ @Shared ] Object 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 control statements.
- Completes the statement.
You can also use
- You can change this part of the syntax. See @Option Directive for more information.
Object operates almost the same as
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 make 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
You can make most of the same members in
Object that you can in
But you cannot use
A list of permitted members follows.
Object without state
PrintLine "I'm a singleton"