• 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

OVERLOAD&OVERRIDE

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys
Pleas tell me....
How to distinguish the practical urage between [OVERLOAD] and [OVERRIDE]?
And in what way can they be applied to?
thanks a lot
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Think illustration by examples would be easier for you to understand:
Method overloading:

Method Overriding:
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Message overloading is having the same method name with different parameters:

method overriding happens when a subclass changes the behaviour of one of its superclasses by implementing the same method in a different way. For example:

This example shows that objects that are Mammals give birth to live young. However, Monotremata (which includes the platypus and the echidna), while they are mammals, lay eggs instead of giving birth to live young. Also, marsupials (kangaroos, opossums, koalas, etc.) give birth to live young but then put the young in a pouch.
An important difference to note is that overloaded methods are bound at compile-time, while overridden methods are determined at run-time.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OverLoading means there will not less than one same method,but these method can have
different arguments for every method.
OverRiding just happened when a subclass entends its superclass by implementing the
same method in a different way. But how the OverRiding is happened in the run-time which
can be called late-binding.but the OverLoading is bound at complie time.
I want to apologize for my poor english,because i came from china.so english is not so good.
thansk
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thinkpad leeak,
Welcome to JavaRanch!
We do not have a lot of rules around here, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic