[fpc-pascal] Implementing a true Singleton - Can we decrease thevisibility of a method?
memsom at interalpha.co.uk
Fri Dec 8 14:30:54 CET 2006
> On 8 dec 2006, at 10:55, Graeme Geldenhuys wrote:
> > I still don't know why we can't decrease visibility in Free Pascal.
> > Is there some internal language design that prevents it?
> At least Borland explicitly says you cannot do that:
Delphi 5 onwards generates a hint for each method that is of a lower
visibility thatn its ancestors implementation.
I've used the following to implement a singleton before:
ISingleton = interface [-----GUID GOES HERE-----]
TSingleton = class(TInterfacedObject, ISingleton)
procedure TSingleton .SingletonAction;
MySingleton := TSingleton.Create;
MySingleton := nil;
More information about the fpc-pascal