Purity, @safety, etc., in generic code

kenji hara k.hara.pg at gmail.com
Fri Feb 22 07:32:33 PST 2013


2013/2/23 deadalnix <deadalnix at gmail.com>

> On Friday, 22 February 2013 at 15:15:02 UTC, kenji hara wrote:
>
>> 2013/2/23 deadalnix <deadalnix at gmail.com>
>>
>>  class A {
>>>     void foo() {}
>>> }
>>>
>>> class B {
>>>     override void foo() const {}
>>> }
>>>
>>> Add a const foo method to A, and B;foo don't overload the same method
>>> anymore.
>>>
>>>
>> B.foo overrides A.foo. It is properly allowed as a particular case in
>> contravariant parameter type.
>>
>> Kenji Hara
>>
>
> I know that. Now if you add a const version of foo in A, B;foo don't
> override the same method anymore.
>

Yes, then the B's definition should raise "mutable A.foo() is not
overridden but hidden in B" (but doesn't because of bug 8366).

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130223/450fa23b/attachment.html>


More information about the Digitalmars-d mailing list