This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I don't like the term "static polymorphism" and would prefer never to use it.
I think all polymorphism is "dynamic" ("runtime" would be a better word) and that is (in Java™) done entirely with method overriding.
Method overloading is probably not polymorphism at all.
Some people say "static polymorphism" which might better be called "compile-time polymorphism" to mean hiding fields and static methods by declaring fields and static methods with the same name/signature. If you look in books like Effective Java by Bloch or our FAQ (no 16) you can find out how much confusion that can cause.
It may be possible to implement compile-time polymorphism in other languages than Java.
Joined: Aug 12, 2008
why method overloading is not involved with polymorphism?
Raj please note this polymorphism is a concept that deals with "same" methods in "different" classes.
Polymorphism is what happens; when you call a method, on a reference; that happens to be of a class that has been extended to another class having that method.
Well.....thats technically correct but lets be frank that sentence will take some time to understand.
But you can always rote learn that sentence and give it to your professor .
From The Demon,
Joined: Mar 09, 2009
Method overloading deals with 2 different methods in the same class, while overriding deals with the same method present in different classes.