Latif Khan wrote:can anyone tell me, what is the use of polymorphism??
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
http://plainoldjavaobject.blogspot.in
Lalit Mehra wrote:have any idea of over riding methods ??? it works on polymorphism ...
and there are other such things too ... like polymorphic references and even polymorphic argument types
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
http://plainoldjavaobject.blogspot.in
Lalit Mehra wrote:what is wrong with method overriding in the case of polymorphism
... can't overridden methods take polymorphic references as arguments ...
... can't overridden methods take polymorphic references as arguments ...
http://plainoldjavaobject.blogspot.in
Lalit Mehra wrote:I know overridden methods are not runtime polymorphic ...
Jeff Verdegan wrote:
Method signatures are not runtime polymorphic.
http://plainoldjavaobject.blogspot.in
Lalit Mehra wrote:
By this ...... can't overridden methods take polymorphic references as arguments ...
I meant
and this
http://plainoldjavaobject.blogspot.in
Lalit Mehra wrote:well in my first example if you can see ...
all references are of type Animal ...
and so all the method calls are based on the type of object that these references refer too which are different ... so methods from different classes will be called
in my second example the method is same but i am passing child classes as arguments ...
which again is an example of polymorphic reference as i can pass a subtype where a supertype is required
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|