Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 3
0
 public CamelToTransportAdapter(Camel c)
 {
     camel = c;
 }