On Tue, 22 Sep 2009 21:21:10 -0400, Jeremie Pelletier <[email protected]> wrote:

Also about contravariance, using your original A and B objects, what would happen in the following case:

void main() {
        A a = new B;
        a.fun(new A); // Error! (in theory)
}

Should the compiler disallow the call or assume there can be a contravariant overload? what happens if theres another subclass requiring a B argument in the a.fun(new A); call.

This will not compile, An A does not implicitly cast to a B.

-Steve

Reply via email to