Private visible?
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Sat Jul 15 03:30:34 PDT 2006
Walter Bright wrote:
> Lucas Goss wrote:
>> Walter Bright wrote:
>>>
>>> Sometimes it is valuable to be able to say "you can't do this
>>> operation with this type". I don't see why this ability should be
>>> restricted to C++.
>>
>> Can someone come up with an example or explain why this would be
>> valuable? To make sure we're on the same page, we're talking about:
>>
>> ----
>> class Base {
>> public:
>> virtual int Number() = 0;
>> };
>> ...
>> class Child : public Base {
>> private:
>> int Number() { return 1; }
>> };
>
> I think it's a bug that the compiler allows this. It should be illegal
> code, because it breaks encapsulation.
Good. That should be documented in the spec then, that isn't mentioned
anywhere, as far as we know.
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list