Hi All, I am preparing for scjp 5. I have read many books(Complete Reference, Khild Mughal, Phillip-Heller, K&B) on java. And now I have a confusion. In Complete Reference and Khaliad Mughal, Overloading is also Polymorphism, but in "Complete Java 2 Certification- Phillip Heller ", writer write strictly that overloading is not polymorphism. I have read Java Specification. In specification, overriding is polymorphism(that is) but about overloading did not write anything.
Group, Please clear my dought, that "Is overloading polymorphism or NOT"
Polymorphism is the way of method binding at run time. That applies to overridden methods only. Overloaded methods are selected at the compile type on behalf of argument passed to the method.
No overriding of method, no polymorphism.
I find verbose definition of Polymorphism as :
In object-oriented programming, polymorphism (from the Greek meaning "having multiple forms") is the characteristic of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a variable, a function, or an object to have more than one form.
In C++, overloading is too called Polymorphism! One liner definition as I recall "One name multiple form"
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
a bit of art, as a gift, the permaculture playing cards