On 12/8/06, Vincent Snijders <[EMAIL PROTECTED]> wrote:
I think the solution is to create a public constructor which throws an NotImplemented exception or something like that.
Ok, that works, or at least stops a developer from trying to create a instance directly. In the exception message, I mention the correct function they should have used.
Note: instead of making function GetSingleton : TSingleton; a global function you could make it class function GetInstance too.
Yes I know, thanks. But I prefer to use the function, as it is less typing, especially when the class name is lengthy. I also normally prefix it with a 'g' to show it is a global singleton function. gLog vs TLogToFile.GetSingleton When you use singletons a lot (as I do), less typing is better. :) PS: I still don't know why we can't decrease visibility in Free Pascal. Is there some internal language design that prevents it? -- Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342' _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal