barista.cpp

来自「深入浅出设计模式(书配套c++源代码)。包含20个设计模式的c++实现。」· C++ 代码 · 共 26 行

CPP
26
字号
#include "Barista.hpp"

using namespace HeadFirstDesignPatterns::Template::Barista;

int main( int argc, char* argv[] ) {

	std::auto_ptr< Tea > tea( new Tea() );	std::auto_ptr< Coffee > coffee( new Coffee() );	std::cout << std::endl << "Making tea..." << std::endl;	tea->prepareRecipe(); 
	std::cout << std::endl << "Making coffee..." << std::endl;	coffee->prepareRecipe();

	std::auto_ptr< TeaWithHook > teaHook( new TeaWithHook() );	std::auto_ptr< CoffeeWithHook > coffeeHook( new CoffeeWithHook() );

	std::cout << std::endl << "Making tea..."<< std::endl;	teaHook->prepareRecipe();

	std::cout << std::endl << "Making coffee..."<< std::endl;	coffeeHook->prepareRecipe();

	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?