예제 #1
0
        public static Trapezium operator -(Trapezium x, Trapezium y)
        {
            Trapezium tmp = new Trapezium();

            tmp.a = x.a - y.a;
            tmp.b = x.b - y.b;
            tmp.c = x.c - y.c;
            tmp.d = x.d - y.d;
            return(tmp);
        }
예제 #2
0
        public static Trapezium operator *(Trapezium x, double y)
        {
            Trapezium tmp = new Trapezium();

            tmp.a = x.a * y;
            tmp.b = x.b * y;
            tmp.c = x.c * y;
            tmp.d = x.d * y;
            return(tmp);
        }
예제 #3
0
        public static Trapezium operator +(Trapezium x, Trapezium y)
        {
            Trapezium tmp = new Trapezium();

            tmp.a = x.a + y.a;
            tmp.b = x.b + y.b;
            tmp.c = x.c + y.c;
            tmp.d = x.d + y.d;
            return(tmp);
        }
예제 #4
0
        public override bool Equals(object x)
        {
            Trapezium obj = (Trapezium)x;

            if (a == obj.a && b == obj.b && c == obj.c && d == obj.d)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        public static Trapezium operator /(Trapezium x, double y)
        {
            if (y == 0.0)
            {
                throw new DivideByZeroException();
            }
            Trapezium tmp = new Trapezium();

            tmp.a = x.a / y;
            tmp.b = x.b / y;
            tmp.c = x.c / y;
            tmp.d = x.d / y;
            return(tmp);
        }