This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hi All! This is my first post. Ron, first what do you mean by actual & declared type.Second in this case (in my view) it should call method b.callme().So how it went to 'a'.
Joined: Aug 05, 2002
Hi Naveed: A a = new B(); The declared type is on the left of variable a i.e. A in this case. So rest of the world (I mean program) will see that type of a is A. However, an object of type B is being refered by a. This is actual type of a. So when you call a method on A, the overridden version in the B will be invoked -- which is generally known as polymorphism.
subject: Why no Polymorphism for instance variables