public static OperatorOverloading operator +(OperatorOverloading obj1, OperatorOverloading obj2)
        {
            OperatorOverloading obj = new OperatorOverloading();

            obj.Num1 = obj1.Num1 + obj2.Num1;
            obj.Str1 = obj1.Str1 + obj2.Str1;
            return(obj);
        }
예제 #2
0
        static void Main(string[] args)
        {
            OperatorOverloading obj = new OperatorOverloading();

            OperatorOverloading obj1 = new OperatorOverloading();

            obj1.Num1 = 10;
            obj1.Str1 = "Vikash ";
            OperatorOverloading obj2 = new OperatorOverloading();

            obj2.Num1 = 10;
            obj2.Str1 = "Kumar";

            obj = obj1 + obj2;
            Console.WriteLine($"Numer:{obj.Num1}, String:{obj.Str1}");
            Console.Read();
        }