Problem of override

Eric Suen eric.suen.tech at gmail.com
Sat Sep 29 07:17:18 PDT 2007


Is this the bug of D compiler or the feature of
D language? this will be a big problem for visitor pattern,
for examples, Parser, like:

visit(IfStatement s);
visit(WhileStatement s);
....

So if I want override some of the method, how? that is really
weird, Java doesn't has this problem...

Eric

"Frank Benoit" <keinfarbton at googlemail.com>
> Does this help?
>
> Eric Suen schrieb:
>>
>> class A {
>>   public char[] test() {
>>     return "A";
>>   }
>> }
>>
>> class B : A {
>    alias A.test test;
>>   public void test(char[] a) {
>>   }
>> }
>>
>> class C : B {
>>   public char[] test() {
>>     return super.test() ~ " C";
>>   }
>> } 




More information about the Digitalmars-d-learn mailing list