Inheritance of purity

Walter Bright newshound2 at digitalmars.com
Sat Feb 25 15:02:55 PST 2012


On 2/25/2012 2:16 PM, deadalnix wrote:
> Le 25/02/2012 22:59, Walter Bright a écrit :
>> On 2/25/2012 1:53 PM, deadalnix wrote:
>>> Le 25/02/2012 22:25, Timon Gehr a écrit :
>>>> By explicitly stating that he is aware of all the overloads:
>>>>
>>>> class B : A {
>>>> alias A.fun fun;
>>>> override void fun() { }
>>>> }
>>>>
>>>> Alternatively:
>>>>
>>>> class B : A{
>>>> override void fun()const{super.fun();}
>>>> override void fun() { }
>>>> }
>>>
>>> So, back to the example above, someone will have to go throw the whole
>>> codebase
>>> and add override void fun()const{super.fun();} all over the place to
>>> fix the
>>> broken code ?
>>
>>
>> No, he can use the alias version.
>
> What would it look like ?

class B : A {
  alias A.fun fun;
  override void fun() { }
}


More information about the Digitalmars-d mailing list