Inheritance of purity

Timon Gehr timon.gehr at gmx.ch
Sat Feb 25 12:38:58 PST 2012


On 02/25/2012 09:05 PM, so wrote:
> On Saturday, 25 February 2012 at 17:57:54 UTC, Timon Gehr wrote:
>>> class A {
>>>     void fun() const { ... }
>>> }
>>>
>>> class B : A {
>>>     override void fun() { ... }
>>> }
>>>
>>> Now I change the class A to become :
>>>
>>> class A {
>>>     void fun() const { ... }
>>>     void fun() { ... }
>>> }
>>>
>>> And suddenly, the override doesn't override the same thing anymore.
>>> Which is unnacceptable.
>>
>> You didn't try to actually compile this, did you? ;D
>
> You can't compile that now, can you?

Exactly, it won't compile. It was an explicit measure to prevent this 
form of function hijacking.


More information about the Digitalmars-d mailing list