polymorphism: overloading vs. overriding

Markus Kranz markus_kranz at gmx.net
Sun May 7 06:00:50 PDT 2006


In article <e3knre$2vp1$1 at digitaldaemon.com>, Bruno Medeiros says...
>In http://www.digitalmars.com/d/function.html , "Function Inheritance 
>and Overriding" it is said:
>"However, when doing overload resolution, the functions in the base 
>class are not considered:"
>If that is the ideal behavior, well, that I'm not sure...
>
>> Of course what dmd says is true, but why can't it implicitly convert expression
>> (baz) of type test.Baz to test.Foo?
>
>Even if you put a cast(Foo) on the argument, it won't compile, because 
>it only considers the overloads (Bar.doIt) of the child class (Bar)
>Once again, if that is the ideal behavior, I'm not sure...

Okay. At least the considered alias construction works.

>> Does 'overriding' in D does not mean the same as in Java?
>> 
>It does. The difference in behavior from Java, is what I said above.

That's soothing.

Regards
Markus





More information about the Digitalmars-d mailing list