Beispiel #1
0
        public void OnAppointment(Employee employee)
        {
            if (employee is Manager)
            {
                // appoint manager
                manager = employee as Manager;
                Appoint?.Invoke(this, employee);
            }
            else

            {
                worker = employee;
                Appoint?.Invoke(this, employee);
            }
        }
Beispiel #2
0
        public void OnAppointment(Employee employee)
        {
            if (employee != null)
            {
                switch (employee)
                {
                case Employee empl when empl is Employee:
                    worker = new Employee(employee);
                    break;

                case Employee empl when empl is Manager:
                    manager = new Manager((Manager)employee);
                    break;

                default:
                    break;
                }

                Appoint.Invoke(this, employee);
            }
        }