A Global Singleton is a class of which only one instance exists within a program.

Any attempt to use non-static members of the class involves performing operations on this one instance.




class Singleton {
  @singleton : static : Singleton;
 
  New : private () {
  }
 
  function : GetInstance() ~ Singleton {
    if(@singleton <> Nil) {
      @singleton := Singleton->New();
    };
 
    return @singleton;
  }
 
  method : public : DoStuff() ~ Nil {
    ...
  }
}