Esempio n. 1
0
        // реализация интерфейса IComparable
        public int CompareTo(object obj)
        {
            Worker_basic worker = obj as Worker_basic;
            int          result = 0;

            if (Age < worker.GetAge)
            {
                result = -1;
            }
            else if (Age > worker.GetAge)
            {
                result = 1;
            }
            else
            {
                if (Salary < worker.CalcSalary())
                {
                    result = -1;
                }
                else if (Salary > worker.CalcSalary())
                {
                    result = 1;
                }
                else
                {
                    result = 0;
                }
            }
            return(result);
        }
Esempio n. 2
0
 // Добавление работника в компанию
 public void Add(Worker_basic wb)
 {
     if (Count < List.Length)
     {
         List[Count] = wb;
         Count++;
     }
     else
     {
         Console.WriteLine($"{Count} < {List.Length}");
     }
 }