using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MethodOverloading
{
class test
{
public void show()
{
Console.WriteLine("No Parameter");
}
public void show(int a)
{
Console.WriteLine("One Parameter " + a);
}
public int show(int a, int b)
{
Console.WriteLine("Two Parameters are " + a + " and " + b);
return a + b;
}
public double show(double a, double b)
{
Console.WriteLine("Two Parameters are " + a + " and " + b);
return a + b;
}
}
class Program
{
static void Main(string[] args)
{
int sum;
double sum1;
test t = new test();
t.show();
t.show(10);
sum = t.show(10, 20);
Console.WriteLine(sum);
sum1 = t.show(10.5, 20.5);
Console.WriteLine(sum1);
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MethodOverloading
{
class test
{
public void show()
{
Console.WriteLine("No Parameter");
}
public void show(int a)
{
Console.WriteLine("One Parameter " + a);
}
public int show(int a, int b)
{
Console.WriteLine("Two Parameters are " + a + " and " + b);
return a + b;
}
public double show(double a, double b)
{
Console.WriteLine("Two Parameters are " + a + " and " + b);
return a + b;
}
}
class Program
{
static void Main(string[] args)
{
int sum;
double sum1;
test t = new test();
t.show();
t.show(10);
sum = t.show(10, 20);
Console.WriteLine(sum);
sum1 = t.show(10.5, 20.5);
Console.WriteLine(sum1);
Console.ReadLine();
}
}
}
Output:
No comments:
Post a Comment