Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Baker        baker    = new Baker();
            BreadBuilder builder  = new RyeBreadBuilder();
            Bread        ryeBread = baker.Bake(builder);

            Console.WriteLine(ryeBread.ToString());
            builder = new WheatBreadBuilder();
            Bread wheatBread = baker.Bake(builder);

            Console.WriteLine(wheatBread.ToString());

            Console.Read();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // создаем объект пекаря
            Baker baker = new Baker();

            BreadBuilder builder  = new RyeBreadBuilder();
            Bread        ryebread = baker.Bake(builder);

            Console.WriteLine(ryebread.ToString());
            builder = new WheatBreadBuilder();
            Bread wheatbread = baker.Bake(builder);

            Console.WriteLine(wheatbread.ToString());

            Console.ReadKey();
        }
Ejemplo n.º 3
0
        public void Run()
        {
            // содаем объект пекаря
            Baker baker = new Baker();
            // создаем билдер для ржаного хлеба
            BreadBuilder builder = new RyeBreadBuilder();
            // выпекаем
            Bread ryeBread = baker.Bake(builder);

            Console.WriteLine(ryeBread.ToString());
            // оздаем билдер для пшеничного хлеба
            builder = new WheatBreadBuilder();
            Bread wheatBread = baker.Bake(builder);

            Console.WriteLine(wheatBread.ToString());

            Console.Read();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Title           = "Builder";

            // Объект пекаря
            Baker baker = new Baker();
            // Строитель для ржаного хлеба
            BreadBuilder breadBuilder = new RyeBreadBuilder();
            // Выпекаем
            Bread ryeBread = baker.Bake(breadBuilder);

            Console.WriteLine(ryeBread.ToString());

            // Строим пшеничный хлеб
            breadBuilder = new WheatBreadBuilder();
            Bread wheatBread = baker.Bake(breadBuilder);

            Console.WriteLine(wheatBread.ToString());

            Console.ReadKey();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Baker baker = new Baker();

            BreadBuilder builder = new RyeBreadBuilder();

            baker.Bake(builder);
            Bread ryeBread = builder.Bread;

            Console.WriteLine(ryeBread.ToString());

            builder = new WheatBreadBuilder();
            baker.Bake(builder);
            Bread wheatBread = builder.Bread;

            Console.WriteLine(wheatBread.ToString());



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



            PizzaBuilder italyBuilder = new MeatPizzaBuilder();

            baker.Bake(italyBuilder);
            Pizza meatPizza = italyBuilder.Pizza;

            Console.WriteLine(meatPizza.ToString());

            italyBuilder = new SeafoodPizzaBuilder();
            baker.Bake(italyBuilder);
            Pizza seafoodPizza = italyBuilder.Pizza;

            Console.WriteLine(seafoodPizza.ToString());

            Console.ReadKey();
        }