• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Does Overloading exhibits Polymorphism behaviour?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does Overloading exhibit Polymorphism behaviour?
If yes, can someone pls explain it
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Asha Lilliete:
Does Overloading exhibit Polymorphism behaviour?
If yes, can someone pls explain it



The method lookup for overloaded methods is done at compile time using the reference type and not the object type, so as far as i know Polymorphishm is only for overidden methods.
 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Overloading of methods is simply having an object type that has multiple methods with the same name, but different method signatures. Those similarly named methods could be renamed to be different, and have the same implementation, and that wouldn't effect polymorphism at all. I'd say no.

Overriding is when a subclass implements a similary named method with it's own implementation. As a result, objects sharing a common ancestry can exhibity specialized behavior, depending upon how they have overridden inherited methods. Now overriding is all about polymorphism, which is essentially the idea that an object type can take on many different forms at runtime. Polymorphism is all over that.

Overloading - not polymorphic
Overriding - the essence of polymorphism

-Cameron McKenzie
reply
    Bookmark Topic Watch Topic
  • New Topic