contravariant argument types: wanna?
BCS
none at anon.com
Sun Sep 27 09:39:44 PDT 2009
Hello Walter,
> Andrei Alexandrescu wrote:
>
>> Second, the new rule is simple: if the overriding function can be
>> called with the overriden function's arguments, it is overriding it.
>> True, things get more complicated when the base class also defines a
>> corresponding overload:
>>
>> class A {
>> void fun(A);
>> void fun(B);
>> }
>> class B : A {
>> override void fun(A);
>> }
>> This must be either an error, or the case that B.fun overrides both
>> overloads of fun in A.
>>
> I would really want to get away from the notion of selecting which
> function is overridden based on being a "better" match.
>
a torture test:
class B
{
void Fn (D,B) {}
void Fn (B,D) {}
}
class D : B
{
void Fn(B,B) {} // override D,B or B,D?
}
More information about the Digitalmars-d
mailing list