posted September 28, 2005 03:56 AM
Hi ,
Whats the explanation for this??
c1.m1(d1);
Output: C
My previous post should explain it.For class C only 3 overloaded versions are available:m1(A a),m1(B b),m1(C c).Now c1 is an instance of
class C.So compiler has to resolve what function to be called
in invocation c1.m1(d1); .Now compiler has to choose
more specific method with respect to argument .Remember C is direct superclass of D.so output will be
C means m1(C c) has been called.