• 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
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

polymorphism,overloading and overiding seems to be the same thing for me

 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys i just read polymorphism,overloading and overridding i felt that their functionalities are almost same ..if there is any difference between these things plase let me know

 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:i just read polymorphism,overloading and overridding i felt that their functionalities are almost same ..



Overloading & overriding are two different things. Overloaded methods are resolved at compile time whereas overriden methods are resolved at the run time depending on the actual object being referenced. When you override a method you can have the advantage of polymorphic behavior.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
polymorphism is just a term for that you can have a lot of forms for something:

Example:

if you have the classes: SomethingMobil, Car, Ferrari, Renault, Toyota, Truck, SomeTruckMark, AnotherTruckMark and so on, you want to say probably, that a truck and a car are kinds of SomethingMobil, also Toyota is a kind of SomethingMobil, but Toyota is also a kind of Car and so on. So you have a lot of forms of SomethingMobil and that thing describes the term polymorphism.

override is way to describe this behavior:

You make:



overloading is something else. It is just the way you can write the same methodname, but have a differend kind of parameters:

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Polymorphism is Overriding not an Overloading. Overriding is expected behavior . but Overloading is an abnormal to an Object
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic