public override void Display() { if (IT_specialist.Count() > 4) { throw new EmployeeException(); } Console.WriteLine(Name); foreach (var item in IT_specialists) { item.Display(); } }
static void Main(string[] args) { Console.WriteLine("Менджеры:"); Employee manager = new Manager() { Name = "Abylai" }; Employee operaotOne = new Manager() { Name = "Bayngali" }; Employee operaotTwo = new Manager() { Name = "Aibol" }; manager.AddSubordinate(operaotOne); manager.AddSubordinate(operaotTwo); manager.Display(); Console.WriteLine("\n"); Console.WriteLine("IT-специалисты:"); Employee it = new IT_specialist() { Name = "Abel" }; Employee IT_specialist1 = new IT_specialist() { Name = "Kap" }; Employee IT_specialist2 = new IT_specialist() { Name = "Dehan" }; Employee IT_specialist3 = new IT_specialist() { Name = "Tomas" }; it.AddSubordinate(IT_specialist1); it.AddSubordinate(IT_specialist2); it.Display(); Console.WriteLine("\n"); Console.WriteLine("Служащие:"); Employee Clerks = new Clerk() { Name = "Mario" }; Employee Clerk1 = new Clerk() { Name = "Equinta" }; Employee Clerk2 = new Clerk() { Name = "Kamil" }; Clerks.AddSubordinate(Clerk1); Clerks.AddSubordinate(Clerk2); Clerks.Display(); }