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

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Dec 8 13:44:02 CET 2006


On 12/8/06, TOndrej <tondrej at gmail.com> wrote:
> On 12/8/06, Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
> > I still don't know why we can't decrease visibility in Free Pascal.
> > Is there some internal language design that prevents it?
>
> A class definition (or at least its parts visible from outside) can be
> understood as a kind of contract. If you have a class TDog with a
> public property Tail then, by definition, any TDog descendant

I understand your example and that makes sense, but would be handy in
certain cases to change it.

> 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.


-- 
Graeme Geldenhuys

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



More information about the fpc-pascal mailing list