• Post Reply Bookmark Topic Watch Topic
  • New Topic

Do method overloading is a type of polymorphism?  RSS feed

 
Vineet Tyagi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Vineet Tyagi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some one please help me to remove my confusion
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vineet Tyagi wrote:Some one please help me to remove my confusion

Well it would help if you actually posted a specific question. If your subject line was supposed to be self-explanatory: it isn't.

Exactly what are you confused about? About all I can tell you right now is that method overloading is the mechanism by which polymorphism is achieved; but I doubt whether that helps much.

Winston
 
Vineet Tyagi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all thanks and yes its helpful a litle bit...im confused because i have a belief that compile time polymorphism is achieved by method overloading.
But Head First Java says that overloading methods has nothing to do with polymorphism!!!
I think now i am more claer about my confusion...
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I knwo there are people who disagree, but I think Head First is correct to say polymorphism requires overriding. That also means that the only thing which can be polymorhpic is the only thing which can be overridden, which is a non‑private non‑final instance method.
 
Vineet Tyagi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answer. I have read in many books that overloading is a type of polymorphism. I do agree that overriding must be there for polymorphism.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vineet Tyagi wrote:I have read in many books that overloading is a type of polymorphism.

Ooops. Mis-read the question. I was talking about method overriding.

In my view: No. Method overloading is NOT a form of polymorphism. You'll sometimes see it referred to as 'static polymorphism', which makes absolutely no sense to me at all, since the term is an oxymoron.

Winston
 
BalaMurali dhar
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, Method overloading is a type of polymorphism
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BalaMurali dhar wrote:yes, Method overloading is a type of polymorphism

So, two disagreeing viewpoints: Would you care to explain why you think overloading is polymorphism?

Winston
 
Vineet Tyagi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BalaMurali dhar wrote:yes, Method overloading is a type of polymorphism


yes please explain your view..
 
Julius Gutierrez
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also think that overloading method is not a type of polymorphism. A polymorphism is an ability of an object to take many forms and as I remember in headfirst, objects are blueprint of a class and object must have state and behavior but overloading methods are only behavior.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!