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

TOndrej tondrej at gmail.com
Fri Dec 8 14:21:14 CET 2006


> > I'm not even sure if there is a language which allows demoting
> > visibility of inherited class members. It would seem odd to me. Just
> > my 2c, of course. ;-)
>
> C++, C#, VB.Net are three I know of.  I think Java also allows it.

In these languages, AFAIK, it's allowed, the compiler generates a
warning, but the visibility does not actually change. You would still
be able to access the member, if not directly on a variable of the
descendant type then certainly by typecasting to the ancestor type.

HTH
TOndrej



More information about the fpc-pascal mailing list