I am just looking at some code where the something strange is happening.
I have the following.
Class B extends A
Class C extends A
Class D extends C
Class A has a method called m() which is overloaded in B and C.
The code I am looking at looks like the below where c is an instance of D.
I would expect the method m() on class A to be called.
What actually happens is that method m() on class C gets called.
Does that mean that the cast of c from D to A is redundant?
Does this type of casting occur at compile-time or at run-time?