Esempio n. 1
0
        static void Main(string[] args)
        {
            //Er is toch maar één shop nodig?
            ComputerShop shop = new ComputerShop();

            Console.WriteLine("[shop creating cheap computers]");
            ComputerFactory lowBudgetComputerFactory = new LowBudgetFactory();

            shop.CreateComputer(lowBudgetComputerFactory);

            Console.WriteLine();

            Console.WriteLine("[shop creating expensive computers]");
            ComputerFactory highBudgetComputerFactory = new HighBudgetFactory();

            shop.CreateComputer(highBudgetComputerFactory);

            Console.ReadKey();
        }
Esempio n. 2
0
        private void Start()
        {
            //A single shop is created because it can use different factory's
            ComputerShop shop = new ComputerShop();

            // create a shop where they assemble expensive computers
            Console.WriteLine("[shop creating expensive computers]");
            ComputerFactory expensiveFactory = new HighBudgetFactory();

            shop.CreateComputer(expensiveFactory);

            Console.WriteLine();

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

            shop.CreateComputer(cheapFactory);
        }