Function Overloading
Here we have overloaded the function ‘area ( )’ to perform three operations- find area of square, find area of rectangle and find area of circle. Thus the function name is same but it is performing different operations. The selection of a particular function for a particular function call is being done on the basis of number, types and sequence of arguments. The first function call has one argument of integer type so it will call the first function as it is taking one integer type argument. The second function call has two arguments of integer type so it will call the second function as it is taking two integer arguments. The third function call has one argument of float type so it will call the third function as it is taking one float argument.
http://
http://
Contributed by:
Rohit kakria
I am software developer
Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=305
Click here to go on website
|