/* main() //*/ int main() { using namespace std; // init cout << "init..\n"; Director director; std::auto_ptr< Product > product; cout << endl; // builder A cout << "builder A\n"; ConcreteBuilderA concBuilderA; director.setBuilder( &concBuilderA); director.construct(); product = director.getProduct(); product->showProduct(); cout << endl; // builder B cout << "builder B\n"; ConcreteBuilderB concBuilderB; director.setBuilder( &concBuilderB); director.construct(); product = director.getProduct(); product->showProduct(); cout << endl; cout << "READY.\n"; return 0; }
int main() { using namespace BUILDER; Director directot; cout << "Build paper." << endl; directot.setBuilder(new PaperBuilder()); directot.createProduct(); Product& paperPrd = directot.getProduct(); paperPrd.showProduct(); cout << "Build usa." << endl; directot.setBuilder(new UsaBuilder()); directot.createProduct(); Product& usaPrd = directot.getProduct(); usaPrd.showProduct(); getchar(); return 0; }