Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
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;     
}