コード例 #1
0
ファイル: Program.cs プロジェクト: selmansener/DesignPatterns
        static void Main(string[] args)
        {
            VehicleBuilder builder;

            // Create shop with vehicle builders

            Shop shop = new Shop();

            // Construct and display vehicles

            builder = new ScooterBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            builder = new CarBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            builder = new MotorCycleBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();

            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            VehicleBuilder builder;
            var            shop = new Shop();

            builder = new CarBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();
            Console.WriteLine();

            builder = new ScooterBuilder();
            shop.Construct(builder);
            builder.Vehicle.Show();
            Console.ReadLine();
        }