I do not understand this Java behavior. I have two classes:
class C1 {
public void m1(double num) {
System.out.println(\"Inside C1.m1(): \" + num
You cannot see methods of C2, because you instance variable is declared as C1 and also because they don't have the same signature. You have double parameter in one method and in second a int type which makes them for JVM completely different methods (so no inheritance will work here).
So if you have int type in C1 method then you need to have also int type in C2 method, then JVM will run method from C2 like you wanted.
Also you can cast variable to C2 type then you will be able to access to methods of C2.