• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Modifiers and Overloading

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do modifiers have anything to do with whether one method is considered to overload another?
For example, would the following 3 methods all be considered overloaded methods if they were all in the same class?
public int someMethod(int a, String b) {}
private int someMethod(String a, boolean b, int c) {}
protected int someMethod(Object x) {}
Is this an example of overloading or do the methods have to have the same modifier?
Thanks in advance.
 
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jordan Drew:
Do modifiers have anything to do with whether one method is considered to overload another?
For example, would the following 3 methods all be considered overloaded methods if they were all in the same class?
public int someMethod(int a, String b) {}
private int someMethod(String a, boolean b, int c) {}
protected int someMethod(Object x) {}
Is this an example of overloading or do the methods have to have the same modifier?
Thanks in advance.


Overloading.. NOPE
Overloading is very old concept.
OO paradigm modifiers will not make a differene
Overloading looks for different signatures thats all
Overriding. Its a whole different ball game
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jordan be clear with one point that overloading has nothing to do with access modifiers(public ,protected,private,default) or return types.All worth is the arguments and the sequence of the same.
THANKS.
reply
    Bookmark Topic Watch Topic
  • New Topic