コード例 #1
0
ファイル: Program.cs プロジェクト: YevhenYeris/Task6
        static void Main()
        {
            ConcreteMediator   m  = new ConcreteMediator();
            ConcreteColleague1 c1 = new ConcreteColleague1(m);
            ConcreteColleague2 c2 = new ConcreteColleague2(m);
            ConcreteColleague3 c3 = new ConcreteColleague3(m);

            m.Colleague1 = c1;
            m.Colleague2 = c2;
            m.Send("How are you?", c1);
            m.Send("Fine, thanks", c2);
            m.Send("Hello!", c3);
            // Wait for user
            Console.Read();
        }
コード例 #2
0
        static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            ConcreteMediator   m  = new ConcreteMediator();
            ConcreteColleague1 c1 = new ConcreteColleague1(m);
            ConcreteColleague2 c2 = new ConcreteColleague2(m);

            m.Colleague1 = c1;
            m.Colleague2 = c2;

            m.Send("How are you?", c1);
            m.Send("Fine, thanks", c2);

            // Wait for user
            Console.Read();
        }