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("吃过饭了吗?");
            c2.Send("没有呢,你打算情况吗");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            ConcreteMediator mediator = new ConcreteMediator();

            ConcreteColleague1 colleague1 = new ConcreteColleague1(mediator);
            ConcreteColleague2 colleague2 = new ConcreteColleague2(mediator);

            mediator.Colleague1 = colleague1;
            mediator.Colleague2 = colleague2;

            colleague1.Send("吃过饭了吗?");
            colleague2.Send("没有呢 , 你打算请客吗?");
        }
Beispiel #3
0
        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("吃过饭了吗?");
            c2.Send("没有呢,你打算请客?");
            Console.Read();
        }
Beispiel #4
0
        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!");

            Console.ReadKey();
        }
Beispiel #5
0
        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!");

            Console.ReadKey();
        }
Beispiel #6
0
        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("吃过饭了吗?");
            c2.Send("没有呢,你打算请客?");

            Console.Read();
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            ConcreteMediator m = new ConcreteMediator();

            ConcreteColleague1 c1 = new ConcreteColleague1(m);
            ConcreteColleague2 c2 = new ConcreteColleague2(m);

            m.Colleage1 = c1;
            m.Colleage2 = c2;

            c1.Send("吃过饭了吗?");
            c2.Send("没有呢,你打算请客?");

            UnitedNationsSecurityCouncil unsc = new UnitedNationsSecurityCouncil();
            USA  usa  = new USA(unsc);
            Iraq iraq = new Iraq(unsc);

            unsc.Usa  = usa;
            unsc.Iraq = iraq;

            usa.Declare("不准研制核武器,否则要发动战争");
            iraq.Declare("我们没有核武器,也不怕侵略");
        }