int main() { Cook cook; HawaiianPizzaBuilder *h = new HawaiianPizzaBuilder; AmericanHotPizzaBuilder *a = new AmericanHotPizzaBuilder; cook.SetBuilder(h); cook.ConstructPizza(); Pizza *p1 = h->getPizza(); p1->Open(); cook.SetBuilder(a); cook.ConstructPizza(); Pizza *p2 = a->getPizza(); p2->Open(); return 0; }
int main() { Cook cook; HawaiianPizzaBuilder hawaiianPizzaBuilder; SpicyPizzaBuilder spicyPizzaBuilder; cook.makePizza(&hawaiianPizzaBuilder); cook.openPizza(); cook.makePizza(&spicyPizzaBuilder); cook.openPizza(); }
int main() { Cook cook; HanoiPizzaBuilder hanoiPizzaBuilder; SaigonPizzaBuilder saigonPizzaBuilder; cook.makePizza(&hanoiPizzaBuilder); cook.openPizza(); cook.makePizza(&saigonPizzaBuilder); cook.openPizza(); system("pause"); return 0; }
int main() { Cook cook; cook.setPizzaBuilder(new HawaiianPizzaBuilder); cook.constructPizza(); Pizza hawaiian = cook.getPizza(); cout << hawaiian << endl; cook.setPizzaBuilder(new DeluxePizzaBuilder); cook.constructPizza(); Pizza deluxe = cook.getPizza(); cout << deluxe << endl; }
int main() { Cook cook; PizzaBuilder* hawaiianPizzaBuilder = new HawaiianPizzaBuilder; PizzaBuilder* spicyPizzaBuilder = new SpicyPizzaBuilder; cook.setPizzaBuilder(hawaiianPizzaBuilder); cook.constructPizza(); Pizza* hawaiian = cook.getPizza(); hawaiian->open(); cook.setPizzaBuilder(spicyPizzaBuilder); cook.constructPizza(); Pizza* spicy = cook.getPizza(); spicy->open(); delete hawaiianPizzaBuilder; delete spicyPizzaBuilder; delete hawaiian; delete spicy; }
int main() { Cook cook; PizzaBuilder* VegPizzaBuilder = new Builder::VegPizzaBuilder(); PizzaBuilder* NonVegPizzaBuilder = new Builder::NonVegPizzaBuilder(); cook.setPizzaBuilder(VegPizzaBuilder); cook.constructPizza(); Pizza* veg = cook.getPizza(); veg->open(); cook.setPizzaBuilder(NonVegPizzaBuilder); cook.constructPizza(); delete VegPizzaBuilder; delete NonVegPizzaBuilder; delete veg; getch(); return 0; }