No subject


Thu Mar 29 20:50:10 PDT 2007


"However, when doing overload resolution, the functions in the base
class are not considered:"
"To consider the base class's functions in the overload resolution
process, use an AliasDeclaration:"

Also see my postings "override and overload" 13-Nov-06
and "aliasing base methods" from 25-Feb-07


Eric Suen schrieb:
> 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