コード例 #1
0
ファイル: main.cpp プロジェクト: Demelode/cs3307a
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;
}
コード例 #2
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;     
}
コード例 #3
0
ファイル: Main.cpp プロジェクト: OpenOrganization007/MI
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;
}