The term "static polymorphism" has been used to refer to overloading. "static" here means that the decision about which method to call is made when the program is compiled. This is in contrast to "dynamic polymorphism", what you get from overriding methods in Java, in which that decision is deferred until runtime.
But some people -- myself included -- dislike this term "static polymorphism," and prefer to use "polymorphism," without qualification, to mean runtime binding of method calls. The term "overloaded methods" is just fine for overloaded methods, which aren't, IMO, an object-oriented concept.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jon Lee
Ranch Hand
Joined: Mar 04, 2005
Posts: 134
posted
0
polymorphism and overloading are different concepts, not comparable...
SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
Ramesh Chandra
Greenhorn
Joined: Oct 20, 2005
Posts: 17
posted
0
Hi Friedman, Thnx for posting me a detailed solution but i have one doubt regarding overloading in the enduser perspective...
generally our understanding is that in overloading , which method is to be called is decided during compile time... but we are passing the values to these overloaded methods during runtime. depending on the values that we give at runtime the proper method will be invoked...
this sounds like dynamic polymorphism as the method to be invoked is decided during the runtime depending upon the values we pass.
hope u understood my probs
Sachin Dimble
Ranch Hand
Joined: Dec 07, 2005
Posts: 100
posted
0
Yes Friedman! There is nothing like early binding in java as each method get bind (or get call) at run-time only. In byte (class) file there is'nt any link for any method.
Make me correct if am wrong!
With Best Regards! Sachin Dimble.
ankur rathi
Ranch Hand
Joined: Oct 11, 2004
Posts: 3829
posted
0
Some points from my side. Please let me know how many are correct:
1] Java doesn't provide user defined operator overloading.
2] Overloading is not an example of polymorphism. It is as good as defining new method, just using the same name.
3] Overridding is the example of polymorphism. Here all games happen. Compiler think something else and JVM execute something else.
[ December 09, 2005: Message edited by: rathi ji ]
Sachin Dimble
Ranch Hand
Joined: Dec 07, 2005
Posts: 100
posted
0
Hi rathi Ji! According to me.. 1] correct 2] Not ok overloading is the kind of polymorphism 3] correct,overriding is also kind of polymorphism.
With Best Regards! Sachin Dimble.
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Originally posted by Sachin Dimble:
2] Not ok overloading is the kind of polymorphism
I disagree. Overloading is nothing more than a fa�on de parler. I can image Java without overloading -- there would have to be a bit of tweaking to admit multiple constructors, and it would be a bit of a pain if a latter version of JComponent introduced a method whose name clashed with one you had introduced in your custom subclass... but by and large Java would be the same. Now image Java without overriding: it's life, but not as we know it.
ps. I've been waiting years to drop fa�on de parler into conversation .
There is no emoticon for what I am feeling!
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
posted
0
Originally posted by Jon Lee: polymorphism and overloading are different concepts, not comparable...
Polymorphism is often used as a synonym for runtime polymorphism, but historically it actually is a much broader concept, and includes overloading. Search for polymorphism on wikipedia.org (or stupid forum software doesn't allow me to post the link here because of some special characters... :roll: ) [ December 09, 2005: Message edited by: Ilja Preuss ]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus