Exemple #1
0
        static void Main(string[] args)
        {
            PcConfigurator configurator = new PcConfigurator();

            Pc pc1 = new Pc();
            // Определяем фабрику для создания конфигурации
            configurator.PcFactory = new HomePcFactory();
            configurator.Configure(pc1);
            PringPcConfiguration("Home configuration", pc1);

            Pc pc2 = new Pc();
            // Определяем фабрику для создания конфигурации
            configurator.PcFactory = new OfficePcFactory();
            configurator.Configure(pc2);
            PringPcConfiguration("Office configuration", pc2);

        }
Exemple #2
0
        static void Main(string[] args)
        {
            PcConfigurator configurator = new PcConfigurator();

            Pc pc1 = new Pc();

            // Определяем фабрику для создания конфигурации
            configurator.PcFactory = new HomePcFactory();
            configurator.Configure(pc1);
            PringPcConfiguration("Home configuration", pc1);

            Pc pc2 = new Pc();

            // Определяем фабрику для создания конфигурации
            configurator.PcFactory = new OfficePcFactory();
            configurator.Configure(pc2);
            PringPcConfiguration("Office configuration", pc2);
        }