コード例 #1
0
        static void Main(string[] args)
        {
            Thermostat thermostat = new Thermostat();

            Heater heater = new Heater(30);

            Cooler cooler = new Cooler(40);

            thermostat.Register(heater);

            thermostat.Register(cooler);

            thermostat.EmulateTemperatureChange();

            thermostat.Unregister(cooler);

            thermostat.EmulateTemperatureChange();

            Console.ReadKey();
        }