| Author |
Strange o/p.Polymorphism in Overrided method?
|
Micheal John
Ranch Hand
Joined: Nov 01, 2006
Posts: 344
|
|
For the above pgm, how the o/p is: AAA In all the three classes m1 has been overrided and polymorphism will come to play. so the below line A3 a4 = new C3(); ref var is A3 and resolved at compile time, but while run time it has to call the C3 object's m1() only.. how it's calling A3 object's m1()?
|
Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
|
Notice there is no overriding because the methods do not have the same signatures.
|
 |
Satish Kota
Ranch Hand
Joined: Feb 08, 2006
Posts: 88
|
|
|
You are not overriding you are overloading the methods. And which methods to be called will be determined by the referenced type
|
SCJP 5.0 77%
|
 |
 |
|
|
subject: Strange o/p.Polymorphism in Overrided method?
|
|
|