Private visible?

David Medlock noone at nowhere.com
Sun Jul 16 18:44:03 PDT 2006


Bruno Medeiros wrote:
> Walter Bright wrote:
> 
>> Lucas Goss wrote:
>>
>>> So the compiler does error with the first two attempts, but the third 
>>> compiles and runs fine.
>>
>>
>> Yes, it is C++ and is perfectly legal C++. A more interesting question 
>> is should it be legal? I posed the question in 
>> comp.lang.c++.moderated, and got a couple of interesting answers.
> 
> 
> Could you post the link to that discussion? (I don't think I can easily 
> find it myself)
> 
> ( Also, if you don't know already, C# adopts an invariant behavior: it 
> disallows to change the protection in any way. Java has a covariant 
> behavior, as mentioned by David. )
> 

Not to mention you can always throw an Exception in the disallowed 
operations, so I don't see this as a great usage of protection attributes.

-DavidM



More information about the Digitalmars-d mailing list