Example #1
0
        static void Main(string[] args)
        {
            // create a clock
            Clock clock = new Clock();

            // create some alarms
            TextAlarm alarm1 = new TextAlarm("Wake up!");
            BeepAlarm alarm2 = new BeepAlarm();

            // attach the alarms to the clock
            clock.Attach(alarm1);
            clock.Attach(alarm2);

            // run the clock for thirty seconds
            clock.Run(30);
        }
Example #2
0
        static void Main(string[] args)
        {
            // create a clock
            Clock clock = new Clock();

            // create some alarms
            ConsoleAlarm alarm1 = new ConsoleAlarm("Wake up!");
            ConsoleAlarm alarm2 = new ConsoleAlarm("Dinner's ready!");

            // attach the alarms to the clock
            clock.Attach(alarm1);
            clock.Attach(alarm2);

            // run the clock for thirty seconds
            clock.Run(30);
        }