I am taking AP Comp Sci and we are learning about polymorphism and inheritance. Our instructor gave us the following problem:
If classes C1 and C2 both implement an interface Cint, which has a method “whichIsIt”, and if C1 c = new C1( ); is performed at one point of the program, then a later instruction c.whichIsIt( ); will invoke the whichIsIt method defined in C1.
Supposedly the answer is false. However, this makes no sense to me. The whole point of polymorphism is that it uses dynamic binding and will use the method that is defined in the lowest class in the hierarchy. How can the answer to this question be false?