public override void Send(string msg, Colleague colleague) { if (colleague == Farmer) { Cannery.MakeKetchup(msg); } else if (colleague == Cannery) { Shop.SellKetchup(msg); } }
static void Main(string[] args) { // var mediator = new CocreteMediator(); 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(); }