Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("This program uses delegates and simulates persons behavior, when every single person come and leave office." +
                              "\nHere is an axample:\n\n");

            List <Person> employees = new List <Person>();

            Person Alex   = new Person("Alex");
            Person Dave   = new Person("Dave");
            Person George = new Person("George");
            Person Jane   = new Person("Jane");

            employees.Add(Alex);
            employees.Add(Dave);
            employees.Add(George);
            employees.Add(Jane);

            Office office = new Office(employees);

            Alex.ComeToOffice();
            Dave.ComeToOffice();
            George.ComeToOffice();
            Jane.ComeToOffice();

            Jane.LeaveOffice();
            Alex.LeaveOffice();
            George.LeaveOffice();
            Console.WriteLine("Dave died.");


            Console.ReadKey();
        }