Пример #1
0
 public override void Send(string msg, Colleague colleague)
 {
     if (colleague == Farmer)
     {
         Cannery.MakeKetchup(msg);
     }
     else if (colleague == Cannery)
     {
         Shop.SellKetchup(msg);
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            var mediator = new ConcreteMediator();
            var farmer   = new Farmer(mediator);
            var cannery  = new Cannery(mediator);
            var shop     = new Shop(mediator);

            mediator.Farmer  = farmer;
            mediator.Cannery = cannery;
            mediator.Shop    = shop;
            farmer.GrowTomato();

            Console.ReadKey();
        }