using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
operator_overloading
{
class Third
{
public int number { get; set; }
public int num = 0;
public static Third operator +(Third
t1, Third t2)
{
Third
t3 = new Third();
t3.num = t1.number + t2.number;
return
t3;
}
}
class Program
{
static void Main(string[]
args)
{
Third
t1 = new Third();
t1.number = 50;
Third
t2 = new Third();
t2.number = 60;
Third
t3 = new Third();
t3 = t1 + t2;
Console.WriteLine(t3.num);
Console.ReadLine();
}
}
}
No comments:
Post a Comment