The decision which method to use basically has two phases: first the overload resolution, then the method dispatch. Overload resolution happens at compile-time, method dispatch at runtime.
In this example the overload resolution decides that the overload someMethod(A param)
should be used because that's the only overload of someMethod
defined in class A
(and the static type of ac
is A
).
At runtime it is decided which implementation of someMethod(A param)
to use, but since there is only one implementation (C.someMethod(C)
does not override someMethod(A)
as C
is more specific than A
), A.someMethod(A)
is chosen.