예제 #1
0
        //Convert the interface of a class into another interface expect.
        //Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
        static void Main(string[] _)
        {
            IMemory camera = new CameraMemory();

            IMemory sd = new SdCardMemoryAdapter(new SdCardMemory());

            camera.Connect();
            camera.GetData();
            camera.SetData();

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

            sd.Connect();
            sd.GetData();
            sd.SetData();

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            IMemory cameraMemory = new CameraMemory();

            IMemory sdCardMemor = new SDCardMemoryAdapter();

            Console.WriteLine("The Camera Memory");
            Console.WriteLine("---------------------");
            cameraMemory.Connect();

            Console.WriteLine("\n");

            Console.WriteLine("The SDCard Memory");
            Console.WriteLine("---------------------");
            sdCardMemor.Connect();

            Console.ReadKey();
        }