void classAdapterTestDrive() { std::cout << "\n** Class Adapter Pattern Test Drive **\n\n"; WildTurkey turkey; std::cout << "The Turkey says...\n"; turkey.gobble(); turkey.fly(); MallardDuck duck; std::cout << "\nThe Duck says...\n"; testDuck(duck); TurkeyClassAdapter turkeyClassAdapter; std::cout << "\nThe TurkeyAdapter says...\n"; testDuck(turkeyClassAdapter); }
int main(int argc, char* argv[]) { MallardDuck* duck = new MallardDuck(); WildTurkey* turkey = new WildTurkey(); Duck* turkeyAdapter = new TurkeyAdapter(); std::cout << "The Turkey says..." << std::endl; turkey->gobble(); turkey->fly(); std::cout << std::endl << "The Duck says..." << std::endl; testDuck(duck); std::cout << std::endl << "The TurkeyAdapter says..." << std::endl; testDuck(turkeyAdapter); return 0; }