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(); }
public void CancelSubscrbe(SchoolRing schoolRing) { schoolRing.onBellSound -= SchoolJow; }
public void SubscrbeToRing(SchoolRing schoolRing) { schoolRing.onBellSound += SchoolJow; }