Esempio n. 1
0
 public void AddToDepartament(Employeе employeе)
 {
     if (Employeеs.Count + 1 <= 10)
     {
         Employeеs.Add(employeе);
     }
     else
     {
         throw new OverflowException("Max employees is 10");
     }
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Department d  = new Department();
            Employeе   e1 = new Employeе();

            e1.EnterEmployee();
            Console.WriteLine(e1);

            try
            {
                d.RemoveEmployee(0);
                d.AddToDepartament(e1);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }