static void Main(string[] args) { var concreteMediator = new ConcreteMediator(); var c1 = new ConcreteColleague1(); var c2 = new ConcreteColleague2(); var c3 = new ConcreteColleague3(); concreteMediator.Register(c1); concreteMediator.Register(c2); concreteMediator.Register(c3); c1.Send("Here's the message from C1"); // c2.Send("Here's the message from C2"); }
static void Main(string[] args) { ConcreteMediator m = new ConcreteMediator(); ConcreteColleague1 c1 = new ConcreteColleague1(m); ConcreteColleague2 c2 = new ConcreteColleague2(m); m.Colleague1 = c1; m.Colleague2 = c2; c1.Send("How are you?"); c2.Send("Fine, thanks"); // Wait for user Console.Read(); }