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

clarify overloading/overriding, polymorphism, dynamic data binding

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need clarification about overloading/overriding, polymorphism, dynamic data binding.
1. Can we achieve polymorphism by overloading or by overriding or by both?
2. Please explain the above with respect to the dynamic data binding?
[ January 23, 2007: Message edited by: Srinivasa Datla ]
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about you tell us what you think the answer might be? Then we won't think you're just someone trying to get us to do your homework.
 
Srinivasa Datla
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OOPS Peter! I didn't think about my question to be answered by a school boy who always bothers about homework. .
I am always confusing about overloading and overriding which are related to polymorphism and data binding. Please clarify this.

-Sri
[ January 23, 2007: Message edited by: Srinivasa Datla ]
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Overloading is a process of defining a method that has same name and different argument list as another method in the same class whereas over-riding is a process of defining a method having same name and argument list as another method in its parent class.


Now it should be clear to you which one acheives polymorphism.
[ January 23, 2007: Message edited by: rao raghu ]
 
author and cow tipper
Posts: 5001
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
In a simple sense, overriding occurs between different classes in a hierarchy. So, a subclass overrides a method inherited from a parent or an ancestor. So, overriding always involves a hierarchy of some sort.

It is through a hierarchy chain, and different behaviors of classes on a common heirarchy chain, that polymorphism is all about. Classes on a hierarchy share behavior, although, by overriding, child classes can implement that common behavior in a customized way - that's what polymorphism is all about.

Overloading can be thought of as potentially happening in a single class, with no hierarchy involved. I can define one class with a million methods named bombsAway(), so long as each method has a different method signature. There's absolutely no obligation for any of those methods to do the same thing. They're just using similar names. In that case, polymorphism doesn't even have any meaning.

Overriding - always happens between classes in a heirarchy chain.

Overloading - can occur within a single class, and does not need to involve a class hierarchy.

-Cameron McKenzie
 
Srinivasa Datla
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Cameron. I got it.

- Sri
 
Wanna see my flashlight? How about this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic