コード例 #1
0
        static void Main(string[] args)
        {
            PassportFactory pf     = PassportFactory.GetInstance();
            Random          random = new Random();

            for (int i = 0; i < 100000; i++)
            {
                if (i % 3 == 0)
                {
                    Employee b1 = new Employee(pf, i + 1, "Бухгалтер", "муж");
                    b1.PrintPassport();
                }
                else if (i % 3 == 1)
                {
                    Employee b1 = new Employee(pf, i + 1, "Программист", "муж");
                    b1.PrintPassport();
                }
                else if (i % 3 == 2)
                {
                    Employee b1 = new Employee(pf, i + 1, "Менеджер", "жен");
                    b1.PrintPassport();
                }
            }
        }
コード例 #2
0
 public Employee(PassportFactory pf, int id, string profession, string gender)
 {
     Id       = id;
     Passport = pf.GetPassport(profession, gender);
 }