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

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 8 13:51:36 CET 2006

On 8 dec 2006, at 13:44, Graeme Geldenhuys wrote:

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



"You should not change the access modifier for inherited members."

So it's possible but discouraged, and they give warnings (and  
sometimes errors) for it with the recommendation "Do not exclude a  
warning from this rule."

As far as I understand the text on that page, the only case where  
it's considered "safe" is if the the method/class is declared  
"final". We do not have final methods/classes in Object Pascal, and  
such final methods/classes are often considered a cause of problems  
in themselves (because you can bet sooner or latter someone will have  
some need to override/inherit anyway).


More information about the fpc-pascal mailing list