/// <summary> /// 中介者模式进销存系统 /// </summary> public void MpPssDemo() { var mediator = new Mediator(); var sale = new SaleMp(mediator); sale.Sell(80); sale.Sell(40); var purchase = new PurchaseMp(mediator); purchase.Buy(50); var stock = new StockMp(mediator); stock.ClearStock(); }
protected AbstractMediator() { Purchase = new PurchaseMp(this); Sale = new SaleMp(this); Stock = new StockMp(this); }