コード例 #1
0
            public static void Main(string[] args)
            {
                EmployeeList empList = new EmployeeList();
                IEmployee    fteA    = new FullTimeEmployee("梁思成", 3200.00, 45);
                IEmployee    fteB    = new FullTimeEmployee("徐志摩", 2000, 40);
                IEmployee    fteC    = new FullTimeEmployee("梁徽因", 2400, 38);
                IEmployee    fteD    = new PartTimeEmployee("方鸿渐", 80, 20);
                IEmployee    fteE    = new PartTimeEmployee("唐宛如", 60, 18);

                empList.AddEmployee(fteA);
                empList.AddEmployee(fteB);
                empList.AddEmployee(fteC);
                empList.AddEmployee(fteD);
                empList.AddEmployee(fteE);

                Department dept = AppConfigHelper.GetDeptInstance() as Department;

                if (dept != null)
                {
                    empList.Accept(dept);
                }

                Console.ReadKey();
            }
コード例 #2
0
            // 实现人力资源部对兼职员工数据的访问
            public override void Visit(PartTimeEmployee employee)
            {
                int workTime = employee.WorkTime;

                Console.WriteLine("临时工 {0} 实际工作时间为:{1} 小时", employee.Name, workTime);
            }
コード例 #3
0
 public abstract void Visit(PartTimeEmployee employee);