예제 #1
0
        static void Main(string[] args)
        {
            Driver driver = new Driver();

            Auto auto = new Auto();

            driver.Travel(auto);

            Camel      camel         = new Camel();
            ITransport camelTrasport = new CamelToTransportAdapter(camel);

            driver.Travel(camelTrasport);

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            // traveler
            Driver driver = new Driver();
            // car
            Auto auto = new Auto();

            // went on a trip
            driver.Travel(auto);
            // met sands,you should use camel
            Camel camel = new Camel();
            // use adapter
            ITransport camelTransport = new CamelToTransportAdapter(camel);

            // continue trip by camel
            driver.Travel(camelTransport);

            Console.Read();
        }
예제 #3
0
 public CamelToTransportAdapter(Camel c)
 {
     camel = c;
 }