Originally posted by Kuldeep Yadav:
One of the query about overloading in my mind.
As we know we can overload methods. In that method having same name but
different parameters OK. e.g
But we can do by taking different name of method.
So what is acual purpose of overloading ?
Kuldeep the point is that how many methos names you will use to denote the functionality. For the simplest example take we have a method named add(int i, int s)
and this methos is overloaded for float and LONG. So now if we go to your way we have to name functions like addFloat or addLong BUT as seen that it is really simple and apt to use one name add() for all the datataypes and arguments.
[ October 15, 2008: Message edited by: Himanshu Gupta ]
Probably best to restrict overloading of methods to instances where all the methods do something similar, but with different kinds of parameter.