static void Main(string[] args)
        {
            // The Builder pattern is useful for creating complex objects that have multiple parts. The creation process of an object should
            // be independent of these parts; in other words the consturction process does not care how these parts are assembled.
            // You should be able to use the same construction process to create different representations of the objects
            Console.WriteLine("Builder Pattern");

            Director director = new Director();

            IBuilder buildOne = new Car("Dodge");
            IBuilder buildTwo = new MotorCycle("Honda");

            director.Construct(buildOne);
            Product p = buildOne.GetVehicle();

            p.Show();

            Console.WriteLine("----------------");

            director.Construct(buildTwo);
            Product p2 = buildTwo.GetVehicle();

            p2.Show();

            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("***Builder Pattern Demo***");
            Director director = new Director();
            IBuilder b1       = new Car("Ford");
            IBuilder b2       = new MotorCycle("Honda");

            // Making Car
            director.Construct(b1);
            Product p1 = b1.GetVehicle();

            p1.Show();
            //Making MotorCycle
            director.Construct(b2);
            Product p2 = b2.GetVehicle();

            p2.Show();
            Console.ReadLine();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("***Builder Pattern Demo***");
            Director director = new Director();

            IBuilder car        = new Car("Mercedes");
            IBuilder motorCycle = new MotorCycle("Honda");

            // Making Car
            director.Construct(car);
            Product p1 = car.GetVehicle();

            p1.Show();

            // Making Car
            director.Construct(motorCycle);
            Product p2 = motorCycle.GetVehicle();

            p2.Show();
        }