Beispiel #1
0
        static void Main(string[] args)
        {
            Director director = new Director();
            Builder builder1 = new ConcreateBuilder1();
            Builder builder2 = new ConcreateBuilder2();

            director.Construct(builder1);
            Product product1 = builder1.GetProduct();
            product1.Show();

            director.Construct(builder2);
            Product product2 = builder2.GetProduct();
            product2.Show();

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Director director = new Director();
            Builder  builder1 = new ConcreateBuilder1();
            Builder  builder2 = new ConcreateBuilder2();

            director.Construct(builder1);
            Product product1 = builder1.GetProduct();

            product1.Show();

            director.Construct(builder2);
            Product product2 = builder2.GetProduct();

            product2.Show();

            Console.ReadKey();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Director dieDirector       = new Director();
            var      concreateBuilder1 = new ConcreateBuilder1();
            var      concreateBuilder2 = new ConcreateBuilder2();

            dieDirector.Construct(concreateBuilder1);
            // 组装完,组装人员搬来组装好的电脑
            Computer computer1 = concreateBuilder1.GetComputer();

            computer1.Show();
            // 老板叫员工去组装第二台电脑
            dieDirector.Construct(concreateBuilder2);
            Computer computer2 = concreateBuilder2.GetComputer();

            computer2.Show();

            Console.Read();
        }