static void Main(string[] args) { Title.UpperIndent(Assembly.GetExecutingAssembly()); Client client = new Client(); IDuck duck = new WildDuck(); client.WorkWithDuck(duck); System.Console.WriteLine(); ITurkey turkey = new WildTurkey(); AdapterTurkeyToDuck adapterTurkeyToDuck = new AdapterTurkeyToDuck(turkey); client.WorkWithDuck(adapterTurkeyToDuck); Title.BottonIndent(); }
static void Main(string[] args) { IDuck duck = new WildDuck(); duck.Quack(); duck.Fly(); ITurkey turkey = new Turkey(); turkey.Gobble(); turkey.Fly(); TurkeyAdapter adapter = new TurkeyAdapter(turkey); adapter.Quack(); adapter.Fly(); Console.ReadKey(); }
static void Main(string[] args) { WildDuck wildDuck = new WildDuck(); WildTurkey wildTurkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(wildTurkey); ITurkey duckAdapter = new DuckAdapter(wildDuck); Console.WriteLine("Indyk mówi:"); wildTurkey.Bubble(); wildTurkey.Fly(); Console.WriteLine("Kaczka mówi:"); TestDuck(wildDuck); Console.WriteLine("Adapter indyka mówi"); TestDuck(turkeyAdapter); Console.WriteLine("Adapter kaczki mówi:"); TestTurkey(duckAdapter); Console.ReadKey(); }