Professional Documents
Culture Documents
}
class Program
{
static void Main(string[] args)
{
ComipleDemo c1 = new ComipleDemo();
double a=c1.Add(12.44,23.55);
Console.WriteLine(a);
Console.Read();
}
Construcotr Overloading
using System;
//Constructor Overloading----Same Class Same funtion With Different Argument list....
namespace Polymorphism_Demo
{
class Employee
{
int salary;
public Employee()
{
salary = 10000;
}
public Employee(int s)
{
salary = s;
}
public void Show()
{
Console.WriteLine("Salary=" + salary);
}
}
class Program
{
static void Main(string[] args)
{
Employee e = new Employee();
e.Show();
Employee e1 = new Employee(30000);
e1.Show();
}
}
Console.Read();
Operator Overloading
using System;
//Method Overloading----Same Class Same funtion With Different Argument list....
namespace Polymorphism_Demo
{
class Employee
{
int salary;
public Employee()
salary = 10000;
}
public Employee(int s)
{
salary = s;
}
public void Show()
{
Console.WriteLine("Salary=" + salary);
}
public static Employee operator +(Employee e1, Employee e2)
{
Employee e3 = new Employee();
e3.salary = e1.salary + e2.salary;
return e3;
}
public static Employee operator +(Employee e, int b)
{
Employee e1=new Employee();
e1.salary = e.salary + b;
return e1;
}
class Program
{
static void Main(string[] args)
{
}
}
Method Overridng
using System;
}
}
Console.Read();