Why is there no parameter contra-variance for overriding?
C++ and Java support return-type covariance when overriding methods. Neither, however, support contra-variance in parameter types - instead, it translates to over loading (Java) or hiding (C++). Why is that ? It seems to me that there is no harm in allowing that. I can find one reason for it in Java - since it has the "choose-the-most-specific-version" mechanism for overloading anyway - but can't think of any reason for C++. Example (Java): class A { public void f(String s) {...} } class B extends A { public void f(Object o) {...} // Why doesn't this override A.f? } On the pure issue of contra