/// <summary> /// 重写发送信息的方法,根据所传对象发送到指定对象消息 /// </summary> /// <param name="message"></param> /// <param name="colleague"></param> public override void Send(string message, Colleague colleague) { if (colleague == colleague1) { //同事1给同事2消息 colleague2.Notify(message); } else { //同事2给同事1消息 colleague1.Notify(message); } }
/// <summary> /// 得到同事对象和发送消息的抽象方法 /// </summary> /// <param name="message"></param> /// <param name="colleague"></param> public abstract void Send(string message, Colleague colleague);