Forums Register Login

Polymorphism

+Pie Number of slices to send: Send
Question :  in this case it should invoke the method which contain speed = 150 . But it is invoking 90 .Why ??

2
+Pie Number of slices to send: Send
Field members are not polymorphic and the variable speedlimit in the honda3 class has not override the previous one but it has actually hide it.polymorphism is only applicable to instance methods(in java).in fact polymorphism also doesn't applies to static methods.regarding hiding fields and methods go through these links
hiding methods
hiding fields.

Praveen.
See where your hand is? Not there. It's next to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 186 times.
Similar Threads
doubt var arg
Problems with variables when accessing XML file
Polymorphism confusion
How a method of another class is getting executed by new classname.methodname
abstract compareTo() errors
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:35:18.