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.




-- <separate include file>
object chk = NULL
class singleton
    public procedure check()
        if chk==NULL then
            chk = this
        elsif this!=chk then
            ?9/0
        end if
        ?"ok"
    end procedure
end class
 
global singleton s = new()
--global singleton s2 = new()
-- </separate include file>
 
s.check()
--s2.check()    -- dies