static void Main(string[] args)
            {
                //好了,现在就可以给手机充电了
                TwoHoleTarget homeTwoHole = new ThreeToTwoAdapter();

                homeTwoHole.Request();
                Console.ReadLine();
            }
            static void Main(string[] args)
            {
                //好了,现在可以充电了
                ITwoHoleTarget change = new ThreeToTwoAdapter();

                change.Request();
                Console.ReadLine();
            }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("--------------------AdapterPattern--------------------");
            Console.WriteLine();

            //对象适配器
            TwoHoleSocketTarket twoHoleSocket = new ThreeToTwoAdatpter();

            twoHoleSocket.Request();

            Console.WriteLine("------------------------------------------------------");

            //类适配器
            ITwoHoleSocketTarket twoHoleSocketInterface = new ThreeToTwoAdapter();

            twoHoleSocketInterface.Request();
            Console.WriteLine("------------------------------------------------------");

            Console.ReadLine();
        }