Esempio n. 1
0
        void Start()
        {
            Console.WriteLine("[shop creating expensive computers]");
            ComputerFactory highBudgetFactory = new HighBudgetFactory();
            ComputerShop    highShop          = new ComputerShop();

            highShop.Assemble(highBudgetFactory);
            Console.WriteLine();
            Console.WriteLine("[shop creating cheap computers]");
            ComputerFactory lowBudgetFactory = new LowBudgetFactory();
            ComputerShop    lowShop          = new ComputerShop();

            lowShop.Assemble(lowBudgetFactory);

            // I created a second shop for low budget factory because it was indicated in the assignment to do so.
        }
Esempio n. 2
0
        void Start()
        {
            // create a shop where they assemble expensive computers
            Console.WriteLine("[shop creating expensive computers]");
            ComputerFactory expensiveFactory = new HighBudgetFactory();
            ComputerShop    shop1            = new ComputerShop(expensiveFactory);

            shop1.AssembleMachine();

            Console.WriteLine();

            // create a shop where they assemble cheap computers
            Console.WriteLine("[shop creating cheap computers]");
            ComputerFactory cheapFactory = new LowBudgetFactory();
            ComputerShop    shop2        = new ComputerShop(cheapFactory);

            shop2.AssembleMachine();

            Console.ReadKey();
        }