Пример #1
0
        /// <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();
        }
Пример #2
0
 protected AbstractMediator()
 {
     Purchase = new PurchaseMp(this);
     Sale     = new SaleMp(this);
     Stock    = new StockMp(this);
 }