• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

polymorphism and overloading

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is overloading by any means concerned with polymorphism ?
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Piotr,
Overloaded functions do not represent the same interface, so maybe your definition is refering to "dynamic polymorphism" mention by Avijeet in the previous message.
 
reply
    Bookmark Topic Watch Topic
  • New Topic