Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <memory>

/*Sleep関数:ms*/
#include <windows.h>
#define WAIT1 1000

using namespace std;

/*******食材*******/
/***生地***/
class Dough{
public:
	string name;
};
struct ThinCrust: public Dough{
	ThinCrust(){
		name = "ThinCrust";
	}
};
struct ThickCrust: public Dough{
	ThickCrust(){
		name = "ThickCrust";
	}
};
struct VeryThinCrust: public Dough{
	VeryThinCrust(){
		name = "VeryThinCrust";
	}
};

/***ソース***/
class Sauce{
public:
	string name;
};
struct MarinaraSauce: public Sauce{
	MarinaraSauce(){
		name = "MarinaraSauce";
	}
};
struct TomatoSauce: public Sauce{
	TomatoSauce(){
		name = "TomatoSauce";
	}
};
struct WhiteSauce: public Sauce{
	WhiteSauce(){
		name = "WhiteSauce";
	}
};

/***チーズ***/
class Cheese{
public:
	string name;
};
struct ReggianoCheese: public Cheese{
	ReggianoCheese(){
		name = "ReggianoCheese";
	}
};
struct MozarellaCheese: public Cheese{
	MozarellaCheese(){
		name = "MozarellaCheese";
	}
};
struct GoatCheese: public Cheese{
	GoatCheese(){
		name = "GoatCheese";
	}
};

/***野菜***/
class Vegetables{
public:
	string name;
};
struct Eggplant: public Vegetables{
	Eggplant(){
		name = "Eggplant";
	}
};
struct Spinach: public Vegetables{
	Spinach(){
		name = "Spinach";
	}
};
struct Onion: public Vegetables{
	Onion(){
		name = "Onion";
	}
};
struct Garric: public Vegetables{
	Garric(){
		name = "Garric";
	}
};
struct Tomato: public Vegetables{
	Tomato(){
		name = "Tomato";
	}
};
struct Mashroom: public Vegetables{
	Mashroom(){
		name = "Mashroom";
	}
};
struct RedPepper: public Vegetables{
	RedPepper(){
		name = "RedPepper";
	}
};

/***ペパロニ***/
class Pepperoni{
public:
	string name;
};
struct ThinSlicedPepperoni: public Pepperoni{
	ThinSlicedPepperoni(){
		name = "ThinSlicedPepperoni";
	}
};
struct ThickSlicedPepperoni: public Pepperoni{
	ThickSlicedPepperoni(){
		name = "ThickSlicedPepperoni";
	}
};
struct ItalianSausage: public Pepperoni{
	ItalianSausage(){
		name = "ItalianSausage";
	}
};

/*******工場インターフェース*******/
class IIngredientFactory{
public:
	virtual unique_ptr<Dough>      createDough() = 0;
	virtual unique_ptr<Sauce>        createSauce() = 0;
	virtual unique_ptr<Cheese>     createCheese() = 0;
	virtual unique_ptr<Pepperoni> createPepperoni() = 0;
	virtual vector<unique_ptr<Vegetables>> createVegetables() = 0;
	virtual ~IIngredientFactory(){};
};

class NYPizzaIngredientFactory: public IIngredientFactory{
	unique_ptr<Dough> createDough() override{
		return make_unique<ThinCrust>();
	};
	unique_ptr<Sauce> createSauce() override{
		return make_unique<MarinaraSauce>();
	};
	unique_ptr<Cheese> createCheese() override{
		return make_unique<ReggianoCheese>();
	};
	unique_ptr<Pepperoni> createPepperoni() override{
		return make_unique<ThinSlicedPepperoni>();
	};
//	void createVegetables(vector<unique_ptr<Vegetables>> &veg) override{
	vector<unique_ptr<Vegetables>> createVegetables() override{
		vector<unique_ptr<Vegetables>>veg;
		veg.push_back(make_unique<Eggplant>());
		veg.push_back(make_unique<Spinach>());
		veg.push_back(make_unique<Onion>());
		veg.push_back(make_unique<Garric>());
		return veg;
	};

};
class ChicagoPizzaIngredientFactory: public IIngredientFactory{

	unique_ptr<Dough> createDough() override{
		return make_unique<ThickCrust>();
	};
	unique_ptr<Sauce> createSauce() override{
		return make_unique<TomatoSauce>();
	};
	unique_ptr<Cheese> createCheese() override{
		return make_unique<MozarellaCheese>();
	};
	unique_ptr<Pepperoni> createPepperoni() override{
		return make_unique<ThickSlicedPepperoni>();
	};
	vector<unique_ptr<Vegetables>> createVegetables() override{
		vector<unique_ptr<Vegetables>>veg;
		veg.push_back(make_unique<Tomato>());
		veg.push_back(make_unique<Onion>());
		veg.push_back(make_unique<Garric>());
		veg.push_back(make_unique<Mashroom>());
		return veg;
	};
};
class CaliforniaPizzaIngredientFactory: public IIngredientFactory{

	unique_ptr<Dough> createDough() override{
		return make_unique<VeryThinCrust>();
	};
	unique_ptr<Sauce> createSauce() override{
		return make_unique<WhiteSauce>();
	};
	unique_ptr<Cheese> createCheese() override{
		return make_unique<GoatCheese>();
	};
	unique_ptr<Pepperoni> createPepperoni() override{
		return make_unique<ItalianSausage>();
	};
	vector<unique_ptr<Vegetables>> createVegetables() override{
		vector<unique_ptr<Vegetables>>veg;
		veg.push_back(make_unique<Onion>());
		veg.push_back(make_unique<Garric>());
		veg.push_back(make_unique<Mashroom>());
		veg.push_back(make_unique<RedPepper>());
		return veg;
	};
};

/*******ピザ概要*******/
/*抽象クラス*/
class Pizza{
protected:
	string name;
	unique_ptr<Dough> dough = nullptr;
	unique_ptr<Sauce> sauce = nullptr;
	unique_ptr<Cheese> cheese = nullptr;
	vector<unique_ptr<Vegetables>> vegetables;
	unique_ptr<Pepperoni> pepparoni = nullptr;
public:
	/*純粋仮想:ピザの詳細は種類ごとで変更*/
	virtual void prepare() = 0;
	void bake();
	void cut();
	void box();
	void setName(string name);
	friend ostream &operator<<(ostream &os, const Pizza &pizza);
	virtual ~Pizza(){};
};

/****ピザ作成手順****/
/*friend関数:クラス外で定義*/
ostream &operator<<(ostream &os, const Pizza &pizza){
	os << endl << "#Order confirmation#"
			<< endl << "name: " << pizza.name
			<< endl<< "dough: " << pizza.dough->name
			<< endl << "sauce: " << pizza.sauce->name
			<< endl << "cheeze: " << pizza.cheese->name;
	if(pizza.pepparoni != nullptr){
		os << endl << "pepparoni: " << pizza.pepparoni->name;
	}
	if(pizza.vegetables.size() != 0){
		os<< endl << "vegetables:";
		for (const auto& oss : pizza.vegetables){
			os << oss->name << ", ";
		}
	}
	cout << endl;
	return os;
}
void Pizza::bake(){
	cout << endl << "レシピ：300度で10分焼く" << endl;
	cout << "ステータス： " << name << "is baking " << endl;
	Sleep(WAIT1);
}
void Pizza::cut(){
	cout << endl << "レシピ：扇型の六枚に切り分ける" << endl;
	cout << "ステータス： " << name << " is cutting " << endl;
	Sleep(WAIT1);
}
void Pizza::box(){
	cout << endl << "レシピ：ロゴプリントした箱にピザを入れる" << endl;
	cout << "ステータス： " << name << " is boxing " << endl;
	Sleep(WAIT1);
}
void Pizza::setName(string name){
	this->name = name;
}

/*******ピザ種類*******/
struct CheesePizza: public Pizza{
	CheesePizza(unique_ptr<IIngredientFactory>& ifactory){
		/*工場で作られた食材を調達*/
		dough = ifactory->createDough();
		sauce =  ifactory->createSauce();
		cheese = ifactory->createCheese();
		cout << "CheesePizza " << "constructor called" << endl;
	}
	void prepare() override{
		cout << endl << name << "pizza preparing now" << endl;
		Sleep(WAIT1);
		cout << "Dough type: " << dough->name << endl;
		Sleep(WAIT1);
		cout << sauce->name << " is adding" << endl;
		Sleep(WAIT1);
		cout << cheese->name <<" is adding" << endl;
	};
};
struct VegetablePizza: public Pizza{
	VegetablePizza(unique_ptr<IIngredientFactory>&ifactory){
		/*工場で作られた食材を調達*/
		dough = ifactory->createDough();
		sauce =  ifactory->createSauce();
		cheese = ifactory->createCheese();
		vegetables = ifactory->createVegetables();
		cout << "VegetablePizza " << "constructor called" << endl;
	}
	void prepare() override{
		cout << endl << name << "pizza preparing now" << endl;
		Sleep(WAIT1);
		cout << "Dough type: " << dough->name << endl;
		Sleep(WAIT1);
		cout << sauce->name << " is adding" << endl;
		Sleep(WAIT1);
		cout << cheese->name <<" is adding"<< endl;
		Sleep(WAIT1);
		cout << "vegetable: ";
		for (auto& veg : vegetables){
			cout << veg->name << ", ";
		}
		cout << endl;
	};
};
struct PepperoniPizza: public Pizza{
	PepperoniPizza(unique_ptr<IIngredientFactory>& ifactory){
		/*工場で作られた食材を調達*/
		dough = ifactory->createDough();
		sauce =  ifactory->createSauce();
		cheese = ifactory->createCheese();
		pepparoni = ifactory->createPepperoni();
		cout << "PepperoniPizza " << "constructor called" << endl;
	}
	void prepare() override{
		cout << endl << name << "pizza preparing now" << endl;
		Sleep(WAIT1);
		cout << " Dough type: " << dough->name << endl;
		Sleep(WAIT1);
		cout << sauce->name << "is adding" << endl;
		Sleep(WAIT1);
		cout << cheese->name <<" is adding"<< endl;
		Sleep(WAIT1);
		cout << pepparoni->name <<" is adding"<< endl;
	};
};

/*******販売店*******/
/*抽象クラス*/
class PizzaStore{
public:
	unique_ptr<Pizza> order_pizza(string type) {
		unique_ptr<Pizza> pizza;
		pizza = create_pizza(type);
		pizza->prepare();
		pizza->bake();
		pizza->cut();
		pizza->box();
		return pizza;
	}
	/*純粋仮想：ピザの種類ごとに調理方法は変更*/
	virtual unique_ptr <Pizza> create_pizza(string type) = 0;
	virtual ~PizzaStore(){};
};
struct NYPizzaStore: public PizzaStore{
	unique_ptr <Pizza> create_pizza(string type) override{
		unique_ptr <Pizza>pizza;
		/*NY工場のオブジェクト生成*/
		unique_ptr<IIngredientFactory>pif(new NYPizzaIngredientFactory());
		if(type == "Cheese"){
			pizza = make_unique<CheesePizza>(pif);
			pizza->setName("NYスタイル　チーズピザ");
		}
		else if(type == "Vegetable"){
			pizza = make_unique<VegetablePizza>(pif);
			pizza->setName("NYスタイル　野菜ピザ");
		}
		else if(type == "Pepperoni"){
			pizza =  make_unique<PepperoniPizza>(pif);
			pizza->setName("NYスタイル　ペパロニピザ");
		}
		else{
			pizza = nullptr;
		}
		return pizza;
	}
};
struct ChicagoPizzaStore: public PizzaStore{
	unique_ptr <Pizza> create_pizza(string type) override{
		/*Chicago工場のオブジェクト生成*/
		unique_ptr<IIngredientFactory>pif(new ChicagoPizzaIngredientFactory());
		unique_ptr <Pizza>pizza;
		if(type == "Cheese"){
			pizza =  make_unique<CheesePizza>(pif);
			pizza->setName("Chicagoスタイル　チーズピザ");
		}
		else if(type == "Vegetable"){
			pizza = make_unique<VegetablePizza>(pif);
			pizza->setName("Chicagoスタイル　野菜ピザ");
		}
		else if(type == "Pepperoni"){
			pizza =  make_unique<PepperoniPizza>(pif);
			pizza->setName("Chicagoスタイル　ペパロニピザ");
		}
		else{
			pizza = nullptr;
		}
		return pizza;
	}
};
struct CaliforniaPizzaStore: public PizzaStore{
	unique_ptr <Pizza> create_pizza(string type) override{
		/*California工場のオブジェクト生成*/
		unique_ptr<IIngredientFactory>pif(new CaliforniaPizzaIngredientFactory());
		unique_ptr <Pizza>pizza;
		if(type == "Cheese"){
			pizza = make_unique<CheesePizza>(pif);
			pizza->setName("Californiaスタイル　チーズピザ");
		}
		else if(type == "Vegetable"){
			pizza = make_unique<VegetablePizza>(pif);
			pizza->setName("Californiaスタイル　野菜ピザ");
		}
		else if(type == "Pepperoni"){
			pizza =  make_unique<PepperoniPizza>(pif);
			pizza->setName("Californiaスタイル　ペパロニピザ");
		}
		else{
			pizza = nullptr;
		}
		return pizza;
	}
};

int main()
{
	/*ピザの受け皿*/
	unique_ptr<Pizza> ptr;

	/*NY店の野菜ピザを注文*/
	NYPizzaStore ny_store;
	ptr = ny_store.order_pizza("Vegetable");
	cout << *ptr << endl;

	/*Chicago店の野菜ピザを注文*/
	ChicagoPizzaStore ch_store;
	ptr = ch_store.order_pizza("Vegetable");
	cout << *ptr << endl;

//	cout << ch_store.order_pizza("Vegetable") << endl;

	/*Chicago店の野菜ピザを注文*/
	CaliforniaPizzaStore ca_store;
	ptr = ca_store.order_pizza("Vegetable");
	cout << *ptr << endl;

//	Pizza& pizza =  ca_store.order_pizza("Vegetable");
//	cout << pizza << endl;

	return 0;
}
/////////////////////////
#include <iostream>
#include <vector>
#include <string>
#include <memory>

/*Sleep関数:ms*/
#include <windows.h>
#define WAIT1 500

using namespace std;

/*******食材*******/
/***生地***/
class Dough{
public:
	string name;
};
struct ThinCrust: public Dough{
	ThinCrust(){
		name = "ThinCrust";
	}
};
struct ThickCrust: public Dough{
	ThickCrust(){
		name = "ThickCrust";
	}
};
struct VeryThinCrust: public Dough{
	VeryThinCrust(){
		name = "VeryThinCrust";
	}
};

/***ソース***/
class Sauce{
public:
	string name;
};
struct MarinaraSauce: public Sauce{
	MarinaraSauce(){
		name = "MarinaraSauce";
	}
};
struct TomatoSauce: public Sauce{
	TomatoSauce(){
		name = "TomatoSauce";
	}
};
struct WhiteSauce: public Sauce{
	WhiteSauce(){
		name = "WhiteSauce";
	}
};

/***チーズ***/
class Cheese{
public:
	string name;
};
struct ReggianoCheese: public Cheese{
	ReggianoCheese(){
		name = "ReggianoCheese";
	}
};
struct MozarellaCheese: public Cheese{
	MozarellaCheese(){
		name = "MozarellaCheese";
	}
};
struct GoatCheese: public Cheese{
	GoatCheese(){
		name = "GoatCheese";
	}
};

/***野菜***/
class Vegetables{
public:
	string name;
};
struct Eggplant: public Vegetables{
	Eggplant(){
		name = "Eggplant";
	}
};
struct Spinach: public Vegetables{
	Spinach(){
		name = "Spinach";
	}
};
struct Onion: public Vegetables{
	Onion(){
		name = "Onion";
	}
};
struct Garric: public Vegetables{
	Garric(){
		name = "Garric";
	}
};
struct Tomato: public Vegetables{
	Tomato(){
		name = "Tomato";
	}
};
struct Mashroom: public Vegetables{
	Mashroom(){
		name = "Mashroom";
	}
};
struct RedPepper: public Vegetables{
	RedPepper(){
		name = "RedPepper";
	}
};

/***ペパロニ***/
class Pepperoni{
public:
	string name;
};
struct ThinSlicedPepperoni: public Pepperoni{
	ThinSlicedPepperoni(){
		name = "ThinSlicedPepperoni";
	}
};
struct ThickSlicedPepperoni: public Pepperoni{
	ThickSlicedPepperoni(){
		name = "ThickSlicedPepperoni";
	}
};
struct ItalianSausage: public Pepperoni{
	ItalianSausage(){
		name = "ItalianSausage";
	}
};

/*******工場インターフェース*******/
class IIngredientFactory{
public:
	virtual Dough*      createDough() = 0;
	virtual Sauce*        createSauce() = 0;
	virtual Cheese*      createCheese() = 0;
	virtual Pepperoni*  createPepperoni() = 0;
	virtual vector<Vegetables*> createVegetables() = 0;
	virtual ~IIngredientFactory(){};
};

class NYPizzaIngredientFactory: public IIngredientFactory{
	Dough* createDough() override{
		return new ThinCrust();
	};
	Sauce* createSauce() override{
		return new MarinaraSauce();
	};
	Cheese* createCheese() override{
		return new ReggianoCheese();
	};
	Pepperoni* createPepperoni() override{
		return new ThinSlicedPepperoni();
	};
	vector<Vegetables*> createVegetables() override{
		vector<Vegetables*>veg = {new Eggplant(), new Spinach(), new Onion(), new Garric()};
		return veg;
	};
};
class ChicagoPizzaIngredientFactory: public IIngredientFactory{

	Dough* createDough() override{
		return new ThickCrust();
	};
	Sauce* createSauce() override{
		return new TomatoSauce();
	};
	Cheese* createCheese() override{
		return new MozarellaCheese();
	};
	Pepperoni* createPepperoni() override{
		return new ThickSlicedPepperoni();
	};
	vector<Vegetables*> createVegetables() override{
		vector<Vegetables*> veg = {new Tomato(), new Onion(), new Garric(), new Mashroom()};
		return veg;
	};
};
class CaliforniaPizzaIngredientFactory: public IIngredientFactory{

	Dough* createDough() override{
		return new VeryThinCrust();
	};
	Sauce* createSauce() override{
		return new WhiteSauce();
	};
	Cheese* createCheese() override{
		return new GoatCheese();
	};
	Pepperoni* createPepperoni() override{
		return new ItalianSausage();
	};
	vector<Vegetables*> createVegetables() override{
		vector<Vegetables*> veg = {new Onion(), new Garric(), new Mashroom(), new RedPepper()};
		return veg;
	};
};

/*******ピザ概要*******/
/*抽象クラス*/
class Pizza{
protected:
	string name;
	Dough* dough = nullptr;
	Sauce* sauce = nullptr;
	Cheese* cheese = nullptr;
	Pepperoni* pepparoni = nullptr;
	vector<Vegetables*> vegetables;
public:
	/*純粋仮想:ピザの詳細は種類ごとで変更*/
	virtual void prepare() = 0;

	void bake();
	void cut();
	void box();
	void setName(string name);
	friend ostream &operator<<(ostream &os, const Pizza &pizza);
	virtual ~Pizza(){
		delete dough;
		delete sauce;
		delete cheese;
		delete pepparoni;
		for(auto &veg : vegetables){
			delete veg;
		}
	};
};

/****ピザ作成手順****/
/*friend関数:クラス外で定義*/
ostream &operator<<(ostream &os, const Pizza &pizza){
	os << endl << "#Order confirmation#"
			<< endl << "name: " << pizza.name
			<< endl<< "dough: " << pizza.dough->name
			<< endl << "sauce: " << pizza.sauce->name
			<< endl << "cheeze: " << pizza.cheese->name;
	if(pizza.pepparoni != nullptr){
		os << endl << "pepparoni: " << pizza.pepparoni->name;
	}
	if(pizza.vegetables.size() != 0){
		os<< endl << "vegetables:";
		for (auto &oss : pizza.vegetables){
			os << oss->name << ", ";
		}
	}
	cout << endl;
	return os;
}
void Pizza::bake(){
	cout << endl << "レシピ：300度で10分焼く" << endl;
	cout << "ステータス： " << name << "is baking " << endl;
	Sleep(WAIT1);
}
void Pizza::cut(){
	cout << endl << "レシピ：扇型の六枚に切り分ける" << endl;
	cout << "ステータス： " << name << " is cutting " << endl;
	Sleep(WAIT1);
}
void Pizza::box(){
	cout << endl << "レシピ：ロゴプリントした箱にピザを入れる" << endl;
	cout << "ステータス： " << name << " is boxing " << endl;
	Sleep(WAIT1);
}
void Pizza::setName(string name){
	this->name = name;
}

/*******ピザ種類*******/
struct CheesePizza: public Pizza{
	CheesePizza(IIngredientFactory& ifactory){
		/*工場で作られた食材を調達*/
		dough = ifactory.createDough();
		sauce =  ifactory.createSauce();
		cheese = ifactory.createCheese();
		cout << "CheesePizza " << "constructor called" << endl;
	}
	void prepare() override{
		cout << endl << name << "pizza preparing now" << endl;
		Sleep(WAIT1);
		cout << "Dough type: " << dough->name << endl;
		Sleep(WAIT1);
		cout << sauce->name << " is adding" << endl;
		Sleep(WAIT1);
		cout << cheese->name <<" is adding" << endl;
	};
};
struct VegetablePizza: public Pizza{
	VegetablePizza(IIngredientFactory& ifactory){
		/*工場で作られた食材を調達*/
		dough = ifactory.createDough();
		sauce =  ifactory.createSauce();
		cheese = ifactory.createCheese();
		vegetables = ifactory.createVegetables();
		cout << "VegetablePizza " << "constructor called" << endl;
	}
	void prepare() override{
		cout << endl << name << "pizza preparing now" << endl;
		Sleep(WAIT1);
		cout << "Dough type: " << dough->name << endl;
		Sleep(WAIT1);
		cout << sauce->name << " is adding" << endl;
		Sleep(WAIT1);
		cout << cheese->name <<" is adding"<< endl;
		Sleep(WAIT1);
		cout << "vegetable: ";
		for (auto& veg : vegetables){
			cout << veg->name << ", ";
		}
		cout << endl;
	};
};
struct PepperoniPizza: public Pizza{
	PepperoniPizza(IIngredientFactory& ifactory){
		/*工場で作られた食材を調達*/
		dough = ifactory.createDough();
		sauce =  ifactory.createSauce();
		cheese = ifactory.createCheese();
		pepparoni = ifactory.createPepperoni();
		cout << "PepperoniPizza " << "constructor called" << endl;
	}
	void prepare() override{
		cout << endl << name << "pizza preparing now" << endl;
		Sleep(WAIT1);
		cout << " Dough type: " << dough->name << endl;
		Sleep(WAIT1);
		cout << sauce->name << "is adding" << endl;
		Sleep(WAIT1);
		cout << cheese->name <<" is adding"<< endl;
		Sleep(WAIT1);
		cout << pepparoni->name <<" is adding"<< endl;
	};
};

/*******販売店*******/
/*抽象クラス*/
class PizzaStore{
public:
	/*参照返し：*/
	Pizza& order_pizza(string type) {
		Pizza *pizza;
		pizza = create_pizza(type);
		pizza->prepare();
		pizza->bake();
		pizza->cut();
		pizza->box();

		return *pizza;
	}
	/*純粋仮想：ピザの種類ごとに調理方法は変更*/
	virtual Pizza* create_pizza(string type) = 0;
	virtual ~PizzaStore(){};
};
struct NYPizzaStore: public PizzaStore{
	Pizza* create_pizza(string type) override{
		Pizza* pizza;
		/*NY工場のオブジェクト生成*/
		IIngredientFactory *pif = new NYPizzaIngredientFactory();
		if(type == "Cheese"){
			pizza = new CheesePizza(*pif);
			pizza->setName("NYスタイル　チーズピザ");
		}
		else if(type == "Vegetable"){
			pizza = new VegetablePizza(*pif);
			pizza->setName("NYスタイル　野菜ピザ");
		}
		else if(type == "Pepperoni"){
			pizza =  new PepperoniPizza(*pif);
			pizza->setName("NYスタイル　ペパロニピザ");
		}
		else{
			pizza = nullptr;
		}
		return pizza;
	}
};
struct ChicagoPizzaStore: public PizzaStore{
	Pizza* create_pizza(string type) override{
		/*Chicago工場のオブジェクト生成*/
		IIngredientFactory *pif = new ChicagoPizzaIngredientFactory();
		Pizza* pizza;
		if(type == "Cheese"){
			pizza =  new CheesePizza(*pif);
			pizza->setName("Chicagoスタイル　チーズピザ");
		}
		else if(type == "Vegetable"){
			pizza =  new VegetablePizza(*pif);
			pizza->setName("Chicagoスタイル　野菜ピザ");
		}
		else if(type == "Pepperoni"){
			pizza =  new PepperoniPizza(*pif);
			pizza->setName("Chicagoスタイル　ペパロニピザ");
		}
		else{
			pizza = nullptr;
		}
		return pizza;
	}
};
struct CaliforniaPizzaStore: public PizzaStore{
	Pizza* create_pizza(string type) override{
		/*California工場のオブジェクト生成*/
		IIngredientFactory *pif = new CaliforniaPizzaIngredientFactory;
		Pizza* pizza;
		if(type == "Cheese"){
			pizza =  new CheesePizza(*pif);
			pizza->setName("Californiaスタイル　チーズピザ");
		}
		else if(type == "Vegetable"){
			pizza =  new VegetablePizza(*pif);
			pizza->setName("Californiaスタイル　野菜ピザ");
		}
		else if(type == "Pepperoni"){
			pizza =  new PepperoniPizza(*pif);
			pizza->setName("Californiaスタイル　ペパロニピザ");
		}
		else{
			pizza = nullptr;
		}
		return pizza;
	}
};

int main()
{
	/*NY店の野菜ピザを注文*/
	NYPizzaStore ny_store;
	cout << ny_store.order_pizza("Vegetable") << endl;

	/*Chicago店の野菜ピザを注文*/
	ChicagoPizzaStore ch_store;
	cout << ch_store.order_pizza("Vegetable") << endl;

	/*Chicago店の野菜ピザを注文*/
	CaliforniaPizzaStore ca_store;
	/*参照変数*/
	Pizza& pizza =  ca_store.order_pizza("Vegetable");
	cout << pizza << endl;

	/********各Storeを動的確保*********/
//	PizzaStore* ns = new NYPizzaStore();
//	PizzaStore* chs = new ChicagoPizzaStore();
//	PizzaStore* cas = new CaliforniaPizzaStore();
//	ns->order_pizza("Vegetable");
//	chs->order_pizza("Vegetable");
//	cas->order_pizza("Vegetable");

//	delete ns;
//	delete chs;
//	delete cas;

	/********まとめて動的確保*********/
	PizzaStore* ps[] = {
			new NYPizzaStore(),
			new ChicagoPizzaStore(),
			new CaliforniaPizzaStore()
	};
	PizzaStore **pps = ps;

	cout << pps[0]->order_pizza("Vegetable") << endl;
	cout << pps[1]->order_pizza("Vegetable") << endl;
	cout << pps[2]->order_pizza("Vegetable") << endl;

	delete pps[0];
	delete pps[1];
	delete pps[2];

	return 0;
}



Compiler output:
a.cc:7:10: fatal error: windows.h: No such file or directory
    7 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.