12 lines
253 B
Text
12 lines
253 B
Text
|
|
Class Singleton
|
||
|
|
static sys inst 'private
|
||
|
|
int instantiated() { return inst }
|
||
|
|
void constructor(){ if not inst then inst=@this }
|
||
|
|
|
||
|
|
'all other methods start with @this=inst
|
||
|
|
end class
|
||
|
|
|
||
|
|
'if not singleton.instantiated
|
||
|
|
new Singleton MySingleton
|
||
|
|
'endif
|