public RumorMediator(RumorFootballer rumorFootballer, AggressiveFootballer agressiveFootballer, Captain captain) { _rumorFootballer = rumorFootballer; _rumorFootballer.SetMediator(this); _aggresiveFootballer = agressiveFootballer; _aggresiveFootballer.SetMediator(this); _captain = captain; _captain.SetMediator(this); }
public void RunClientCode() { Console.WriteLine("***** START MEDIATOR *****"); var rumorFootballer = new RumorFootballer(); var aggressiveFootballer = new AggressiveFootballer(); var captain = new Captain(); var mediator = new RumorMediator(rumorFootballer, aggressiveFootballer, captain); mediator.Notify(rumorFootballer, "I heared you have ugly wife."); mediator.Notify(rumorFootballer, "I heared about your salary. Really you earn 1000000$?"); mediator.Notify(aggressiveFootballer, "I heared about your new Car."); Console.WriteLine("***** END MEDIATOR *****"); }