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(); }
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(); }
public CamelToTransportAdapter(Camel c) { camel = c; }