Пример #1
0
        //适配
        public static void testAdaptee()
        {
            Player b = new Forwards("巴蒂尔");

            b.Attack();

            Player m = new Guards("麦克格雷迪");

            m.Attack();

            //Player ym = new Center("姚明");
            Player ym = new Translator("姚明");

            ym.Attack();
            ym.Defense();

            Console.Read();
        }
        public void TestMethodAdapter_Example()
        {
            Player b = new Forwards("Leo");

            b.Attack();

            Player m = new Guards("ken");

            m.Attack();

            Player ym = new Center("小明");

            ym.Attack();
            ym.Defense();

            Player ym2 = new Translator("阿木");

            ym2.Attack();
            ym2.Defense();
        }