Esempio n. 1
0
        static void Main(string[] args)
        {
            IThreeHole threehole = new PowerAdapter();

            threehole.Request();
            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main()
        {
            // 现在客户可以调用3孔插座的接口来实现2孔插头的功能了
            IThreeHole threeHole = new PowerAdapter();

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

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

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

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

            threeholeClass.Request();


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

            threeholeObject.Request();


            Console.ReadLine();
        }