int main() { Car* car; // Final product /* A director who controls the process */ Director director; /* Concrete builders */ JeepBuilder jeepBuilder; NissanBuilder nissanBuilder; /* Build a Jeep */ std::cout << "Jeep" << std::endl; director.setBuilder(&jeepBuilder); // using JeepBuilder instance car = director.getCar(); car->specifications(); std::cout << std::endl; /* Build a Nissan */ std::cout << "Nissan" << std::endl; director.setBuilder(&nissanBuilder); // using NissanBuilder instance car = director.getCar(); car->specifications(); return 0; }
/* 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() { Korean korean; American american; Director director; director.setBuilder(&korean); cout << director.construct() << endl; director.setBuilder(&american); cout << director.construct() << endl; }
int main() { Builder * builder = new ConcreteBuilder(); Director director; director.setBuilder(builder); Product *pd = director.constuct(); pd->show(); delete builder; delete pd; return 0; }
int main() { Director d; //GoF ���Ͽ��� ������ Korea k; Spain s; // ������.. �� �����!! d.setBuilder(&s); //����ڰ� ij���� ���� ȭ��ǥ Ű�� // ������... Character c = d.Construct(); cout << c << endl; }
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; }
int main() { Director* d = new Director(); d->setBuilder(new dfBuilder()); d->orderCake("sacher"); d->orderCake("tresLeches"); d->orderCake("imposible"); d->orderCake("imposible"); d->orderCake("imposible"); d->printCakes(); std::cout << "Tenemos " << d->getCakesCount() << " pasteles" << std::endl; std::cout << "Hay un imposible en la posicion " << d->searchCake("imposible") << std::endl; d->searchCake("tresLeches"); return 0; }