• Post Reply Bookmark Topic Watch Topic
  • New Topic

overload  RSS feed

 
Jimmian Lin
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I was wondering. Is it possible to overload static methods. I have a static int array method that I made two copies of. The difference between the two methods are that theri argument parameters are different.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it and see.
 
Jimmian Lin
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant I did try it. It doesn't work, so I'm wondering if it is really the case or if I might have made a careless error in the code. The book I have seems to say that if your args are different, overload should be okay. But it doesn't say anything about what happens with static return methods
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More likely another error. Look at the Math class which has many overloaded static methods. Please post the error message.

Remember overloading means different parameters, not different return type.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!