Exemplo n.º 1
0
        public static MySpecialClass operator *(MySpecialClass opr1, MySpecialClass opr2)
        {
            MySpecialClass obj = new MySpecialClass();

            obj.Number1 = opr1.Number1 * opr2.Number1;
            obj.Number2 = opr1.Number2 * opr2.Number2;
            return(obj);
        }
Exemplo n.º 2
0
        // The Block should be
        // 1. public
        //2. static
        //3. Use the operator keyword
        //4. Operator
        public static MySpecialClass operator -(MySpecialClass opr)
        {
            MySpecialClass obj = new MySpecialClass();

            obj.Number1 = -opr.Number1;
            obj.Number2 = -opr.Number2;
            return(obj);
        }