Exemplo n.º 1
0
        static void Main(string[] args)
        {
            SchoolRing sr  = new SchoolRing();
            Student    stu = new Student();

            stu.SubscrbeToRing(sr);

            Console.WriteLine("请输入打铃参数(1.表示打上课铃,2表示打下课铃):");
            int ringKing = Convert.ToInt32(Console.ReadLine());

            sr.Jow(ringKing);

            Console.ReadKey();
        }
Exemplo n.º 2
0
 public void CancelSubscrbe(SchoolRing schoolRing)
 {
     schoolRing.onBellSound -= SchoolJow;
 }
Exemplo n.º 3
0
 //退订与订阅
 public void SubscrbeToRing(SchoolRing schoolRing)
 {
     schoolRing.onBellSound += SchoolJow;
 }