> 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: > http://info.borland.com/techpubs/delphi/delphi5/oplg/classes.html
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: unit x; interface type ISingleton = interface [-----GUID GOES HERE-----] procedure SingletonAction; end; var MySingleton: ISingleton; implementation type TSingleton = class(TInterfacedObject, ISingleton) private procedure SingletonAction; end; procedure TSingleton .SingletonAction; begin [....] end; initialization MySingleton := TSingleton.Create; finalization MySingleton := nil; end. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal