METHOD OVERLOADING.

Total Post:9

Points:63
OOPS 
 2099  View(s)
Ratings:
Rate this:
What is Method OverLoading?
  1. Post:5

    Points:35
    Re: Method Overloading.

    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.

      Modified On Mar-29-2018 03:38:35 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!