示例#1
0
        static void Main(string[] args)
        {
            IThreeHole threehole = new PowerAdapter();

            threehole.Request();
            Console.ReadLine();
        }
示例#2
0
文件: Adapter.cs 项目: yojan126/Learn
        static void Main()
        {
            // 现在客户可以调用3孔插座的接口来实现2孔插头的功能了
            IThreeHole threeHole = new PowerAdapter();

            threeHole.Request();
        }
示例#3
0
        static void Main(string[] args)
        {
            // 现在客户端可以通过电适配要使用2个孔的插头了
            IThreeHole threehole = new PowerAdapter();

            threehole.Request();
            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            //类适配器
            //IThreeHole threeHole = new PowerAdapter();
            //threeHole.Request();

            //对象适配器
            IThreeHole threeHole = new PowerAdapter();

            threeHole.Request();
            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            // 现在客户端可以通过电适配要使用2个孔的插头了【类的适配器模式】
            IThreeHole threeholeClass = new PowerAdapter();

            threeholeClass.Request();


            // 现在客户端可以通过电适配要使用2个孔的插头了【对象的适配器模式】
            ThreeHole threeholeObject = new PowerAdapterObject();

            threeholeObject.Request();


            Console.ReadLine();
        }