Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Result
- {
- public int Value { get; set; }
- public static Result operator +(Result c1, Result c2)
- {
- return new Result { Value = c1.Value + c2.Value };
- }
- public static bool operator >(Result c1, Result c2)
- {
- return c1.Value > c2.Value;
- }
- public static bool operator <(Result c1, Result c2)
- {
- return c1.Value < c2.Value;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- short a = 10;
- int b = 25;
- Result res1 = new Result{Value = (int)a };
- Result res2 = new Result { Value = b };
- Result total = res1 + res2;
- Console.WriteLine(total.Value);
- Console.Read();
- }
- }
- }
Add Comment
Please, Sign In to add comment