コード例 #1
0
ファイル: Program.cs プロジェクト: zhwtf/DesignPatternExample
        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();
        }
コード例 #2
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();
        }