static void Main(string[] args) { MallardDuck mallardDuck = new MallardDuck(); WildTurkey wildTurkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(wildTurkey); turkeyAdapter.Fly(); turkeyAdapter.Quack(); }
private static void TurkeyTestDrive() { IDuck duck = new MallardDuck(); ITurkey duckAdapter = new DuckAdapter(duck); for (int i = 0; i < 10; i++) { Console.WriteLine("The DuckAdapter says..."); duckAdapter.Gobble(); duckAdapter.Fly(); } }
static void Main(string[] args) { var turkey = new WildTurkey(); var duck = new MallardDuck(); var ducks = new List <IDuck> { duck, new DuckAdapter(turkey) }; Run(ducks); Console.Read(); }
private static void Main() { var duck = new MallardDuck(); var turkey = new WildTurkey(); var turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The Turkey says..."); turkey.Gobble(); turkey.Fly(); Console.WriteLine("\nThe Duck says..."); TestDuck(duck); Console.WriteLine("\nThe TurkeyAdapter says..."); TestDuck(turkeyAdapter); }
static void Main(string[] args) { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The turkey says:"); turkey.Gobble(); turkey.Fly(); Console.WriteLine("\nThe duck says:"); TestDuck(duck); Console.WriteLine("\nThe turkeyAdapter says:"); TestDuck(turkeyAdapter); }
void simulate() { IQuackable mallardDuck = new MallardDuck(); IQuackable redheadDuck = new RedheadDuck(); IQuackable duckCall = new DuckCall(); IQuackable rubberDuck = new RubberDuck(); IQuackable gooseDuck = new GooseAdapter(new Goose()); Console.WriteLine("Duck Simulator : With Goose Adapter"); simulate(mallardDuck); simulate(redheadDuck); simulate(duckCall); simulate(rubberDuck); simulate(gooseDuck); }
static void Main() { MallardDuck mallardDuck = new MallardDuck(); WildTurkey wildTurkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(wildTurkey); Console.WriteLine("\nThe Turkey says..."); wildTurkey.Gobble(); wildTurkey.Fly(); Console.WriteLine("\nThe Duck says"); TestDuck(mallardDuck); Console.WriteLine("\nThe TurkeyAdapter says"); TestDuck(turkeyAdapter); }
public static void Adapter() { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The Turkey says"); turkey.Gobble(); turkey.Fly(); Console.WriteLine("The Duck says..."); TestDuck(duck); Console.WriteLine("The Turkey Adapter says..."); TestDuck(turkeyAdapter); }
static void Main() { IDuck duck = new MallardDuck(); duck.Quack(); duck.Fly(); ITurkey turkey = new WildTurkey(); turkey.Gobble(); turkey.Fly(); IDuck adapter = new DuckAdapter(turkey); adapter.Quack(); adapter.Fly(); Console.ReadLine(); }
static void Main(string[] args) { WildTurkey turkey = new WildTurkey(); MallardDuck duck = new MallardDuck(); Duck turkeyAdapter = new TurkeyAdapter(turkey); turkeyAdapter.Fly(); turkeyAdapter.Quack(); //Console.WriteLine("The turkey says"); //turkey.Gobble(); //turkey.fly(); //Console.WriteLine("The duck says"); //testDuck(duck); //Console.WriteLine("The TurkeyAdapter says"); //testDuck(turkeyAdapter); }
static void Main(string[] args) { //Se crean objetos Pato y Pavo. MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); //Se crea un Pavo disfrazado de Pato envolviendolo en un adaptador. IDuck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The Turkey says: "); turkey.Gobble(); turkey.Fly(); Console.WriteLine("\nThe Duck says: "); duck.Quack(); duck.Fly(); Console.WriteLine("\nThe Undercover Turkey says: "); testDuck(turkeyAdapter); Console.ReadKey(); }