Home > DeveloperSection > Forums > Method Overloading.
Pushpendra Singh

Total Post:9

Points:63
Posted on    December-18-2010 5:10 AM

 OOPS OOPS 
Ratings:


 1 Reply(s)
 1283  View(s)
Rate this:
What is Method OverLoading?


John William
John William

Total Post:5

Points:35
Posted on    December-18-2010 6:41 AM

It is possible to define two or more methods within the same class that having the same name, as long as their parameter declarations are different. When this is the case, the methods are said to be overloaded, and the process is referred to as method overloading.

Same method name but having different types of signatures in the same scope.

public class AddNumber
{
public int Add(int x, int y)
{
return x+y;
}

public int Add(int x, int y, int z)
{
return x+y+z;
}

}

We define a Add method, in two different versions. The first one takes two paramaters, for adding two numbers, while the second version takes three parameters.

Don't want to miss updates? Please click the below button!

Follow MindStick