my dog learned polymorphism
The moose likes OO, Patterns, UML and Refactoring and the fly likes polymorphism and overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "polymorphism and overloading" Watch "polymorphism and overloading" New topic

polymorphism and overloading

ali farid
Ranch Hand

Joined: Aug 26, 2000
Posts: 60

Is overloading by any means concerned with polymorphism ?
Avijeet Dash
Ranch Hand

Joined: Jan 21, 2001
Posts: 148
Polymorphisim is simply 'same name and many forms'.
static polymorphism:
It can be in the form of operator overloading (c++, or '+' for string concatenation in Java ). It can be function overloading i.e. same function name with different input argumant types in the same class or sub classes.
dynamic polymorphism:
function overriding can be done only in subclasses, which means same function name and input arguments and the implementation is different.
Piotr Aniola

Joined: Feb 20, 2001
Posts: 3
The generally accepted definition of polymorphism is:
"Ability to hide multiple implementations behind a single interface."
So I agree function overloading is polymorphism. So is operator overloading. Any kind of overloading will be polymorphic because the same interface is used to refer to different behaviours.

Piotr Aniola
Mark Savory
Ranch Hand

Joined: Feb 08, 2001
Posts: 122
Overloaded functions do not represent the same interface, so maybe your definition is refering to "dynamic polymorphism" mention by Avijeet in the previous message.
I agree. Here's the link:
subject: polymorphism and overloading
It's not a secret anymore!