Exemple #1
0
 public override void Send(string message, Colleague colleague)
 {
     if (colleague == Farmer)
     {
         Cannery.MakeKetchup(message);
     }
     else if (colleague == Cannery)
     {
         Shop.SellKetchup(message);
     }
 }
Exemple #2
0
        public void StartBusiness()
        {
            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.GrowTomate();
        }