static void Main(string[] args) { Console.WriteLine("Adapter Pattern!"); Adaptee adaptee = new Adaptee(); ITarget target = new Adapter(adaptee); Console.WriteLine(target.GetRequest()); }
static void Main() { var api = new ExternalApi(); var target = new Adapter(api); Console.WriteLine("Adaptee interface is incompatible with the client."); Console.WriteLine("But with adapter client can call it's method."); Console.WriteLine(target.GetRequest()); }
static void Main(string[] args) { Adaptee adaptee = new Adaptee(); ITarget target = new Adapter(adaptee); Console.WriteLine("Adaptee interface is incompatible with the client."); Console.WriteLine("But with adapater, client can call it's method!"); Console.WriteLine(target.GetRequest()); Console.ReadLine(); }
static void Main(string[] args) { Adaptee adaptee = new Adaptee(); ITarget target = new Adapter(adaptee); Console.Write("This is the adapted class. "); Console.WriteLine(target.GetRequest()); Console.WriteLine(); Console.Write("Convert the type of GetSum from long to int: "); Console.WriteLine(target.GetSum(50, 50)); }