Simple Function-Overloading Example

Rajesh_Kumar
Posted by Rajesh_Kumar under OOPS category on | Points: 40 | Views : 718
In Function-Overloading,method name is same,but parameters are different.

public int sum_numbers(int a, int b)
{
return a + b;
}

public int sum_numbers(int a, int b, int c)
{
return a + b + c;
}

int sum1 = sum_numbers(1, 4);
int sum2 = sum_numbers(1, 4, 8);



In above code,we have 2 methods with same name as sum_numbers,but both method have different parameters.

Comments or Responses

Login to post response