示例#1
0
        static void Main(string[] args)
        {
            AbstractCustomer customer1 = CustomerFactory.GetCustomer("Rob");
            AbstractCustomer customer2 = CustomerFactory.GetCustomer("Bob");
            AbstractCustomer customer3 = CustomerFactory.GetCustomer("Julie");
            AbstractCustomer customer4 = CustomerFactory.GetCustomer("Laura");

            Console.WriteLine("Customers");
            Console.WriteLine(customer1.GetName());
            Console.WriteLine(customer2.GetName());
            Console.WriteLine(customer3.GetName());
            Console.WriteLine(customer4.GetName());
            Console.ReadKey();
        }
示例#2
0
        public static void Demo()
        {
            AbstractCustomer c1 = CustomerFactory.GetCustomer("A");
            AbstractCustomer c2 = CustomerFactory.GetCustomer("D");
            AbstractCustomer c3 = CustomerFactory.GetCustomer("B");
            AbstractCustomer c4 = CustomerFactory.GetCustomer("e");

            Console.WriteLine(c1.GetName());
            Console.WriteLine(c2.GetName());
            Console.WriteLine(c3.GetName());
            Console.WriteLine(c4.GetName());


            Console.Read();
        }