예제 #1
0
        /// <summary>
        /// 测试委托
        /// </summary>
        public static void TestDelegate()
        {
            var w        = new Watch();
            var alarm    = new Alarm();
            var alarmBtn = new AlarmButton();

            w.ReachTime += alarm.Belling;
            w.ReachTime += alarmBtn.Press;
            w.Work();
        }
예제 #2
0
 public Watch()
 {
     this.alarm       = new Alarm();
     this.alarmButton = new AlarmButton();
 }