public static OperOver operator +(OperOver l, OperOver m) { OperOver temp = new OperOver(); temp.num1 = l.num1 + m.num1; temp.num2 = l.num2 + m.num2; return(temp); }
static void Main(string[] args) { Console.WriteLine("P object"); OperOver p = new OperOver(); p.SetValues(100, 200); p.GetValues(); Console.WriteLine("q object"); OperOver q = new OperOver(); q.SetValues(500, 1000); q.GetValues(); Console.WriteLine("r object"); OperOver r = new OperOver(); r = p + q; r.GetValues(); }