Method overloading means same mehtod name and same return type but number of parameter is defferant ,sequence of parameter may be also defferant.and also datatype of parameter is defferant.
For Example:
namespace CP_Method_overloading
{
class A
{
public int sum(int a, int b)
{
return a + b;
}
public int sum(int a, int b,int c)
{
return a + b+c;
}
public double sum(int a, double b)
{
return a + b;
}
}
class Program
{
static void Main(string[] args)
{
A obj =new A();
Console.WriteLine(obj.sum(10, 15));
Console.WriteLine(obj.sum(10, 15, 20));
Console.WriteLine(obj.sum(10, 71.52));
}
}
}
Output:
25
45
81.52
See Also :
- Android Installation for beginners_Part-1
- Android Installation for beginners
- How to Resize a Partition in Windows 7 or Vista
- How to customize send to menu.
- How to change Folder background in windows 7
--
/\/ir@\/ <(.'.)>
0 comments:
Post a Comment
Thanks for comment