//! Client
int main() {
	std::auto_ptr<MallardDuck> duck (new MallardDuck());
	
	std::auto_ptr<WildTurkey> turkey (new WildTurkey());
	std::auto_ptr<Duck> turkeyAdapter (new TurkeyAdapter(turkey.get()));
	
	std::cout << "The Turkey says..." << std::endl;
	turkey->gobble();
	turkey->fly();
	
	std::cout << "The Duck says..." << std::endl;
	testDuck(duck.get());
	
	std::cout << "The Turkey Adapter says..." << std::endl;
	testDuck(turkeyAdapter.get());

	return 0;
}
Esempio n. 2
0
int main(int argc, char* argv[])
{
	shared_ptr<MallardDuck> duck(new MallardDuck());

	shared_ptr<WildTurkey> turkey(new WildTurkey());
	shared_ptr<Duck> turkeyAdapter(new TurkeyAdapter(turkey));

	cout << "The Turkey says..." << endl;
	turkey->gobble();
	turkey->fly();

	cout << endl << "The Duck says..." << endl;
	testDuck(duck);
	
	cout << endl << "The TurkeyAdapter says..." << endl;
	testDuck(turkeyAdapter);

	return 0;
}