[fpc-pascal] Implementing a true Singleton - Can we decrease the visibility of a method?

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Dec 11 08:38:55 CET 2006

On 12/8/06, Marc Santhoff <M.Santhoff at t-online.de> wrote:
> One working solution is to use a global var. This is bad but acceptable
> for a singleton imo. If would be nice if the variable could be hidden.

This is kinda what I have been using all along, except, I have a
function, that creates the instance when used for the first time.  I
call it the Lazy mans Singleton.  It works perfectly, if the developer
knows about the global function!  Otherwise, they might still try and
create a instance of the class, which is what I am trying to prevent.

Graeme Geldenhuys

There's no place like S34° 03.168'  E018° 49.342'

More information about the fpc-pascal mailing list