Exemple #1
0
        public int CompareTo(object obj)
        {
            Figure p = (Figure)obj;

            if (this.Area() < p.Area())
            {
                return(-1);
            }
            else if (this.Area() == p.Area())
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }
Exemple #2
0
        public int CompareTo(object obj)
        {
            //Приведение параметра к типу "фигура"
            Figure p = (Figure)obj;  //Сравнение

            if (this.Area() < p.Area())
            {
                return(-1);
            }
            else if (this.Area() == p.Area())
            {
                return(0);
            }
            else
            {
                return(1); //(this.Area() > p.Area())
            }
        }