Hi,
Shankar Reddy: What do you mean by "advantage from naming convention"? What advantage could that possibly provide any application or program?
Abdul Khader: I believe method overloading is about the "same form different uses" kind of thing. The example for add() with different number of arguments was a little crude, I feel. Consider a different scenario :-
1) add(int,int) and
2) add(float, float)
which IMHO would make so much more sense than
1) addInt(int, int) and
2) addFloat(float, float) right?
Yes internally reflection will have to be used to identify the correct implementation that needs to be invoked based on the arguments but I don't feel that would be a huge effect on the performance. Anyways overloading was always one of the basic advantages of OOPs. One other advantage I can think of now is it improves the readability of the code. I say Anybody can write code but writing code that can be maintained by himself or somebody else can be considered a challenge in itself.
Check out some of these links :-
http://www.geekinterview.com/question_details/17255 http://www.geekinterview.com/Interview-Questions/Concepts/OOPS Cheers,
Raj.
[ May 13, 2008: Message edited by: Raj Kamal R ]