patterns/factorymethod/pizzafactorymethod/chicagopizzastore.d

36 lines
921 B
D
Raw Normal View History

2022-12-05 07:38:19 +00:00
module factorymethod.pizzafactorymethod.chicagopizzastore;
import factorymethod.pizzafactorymethod.pizza;
import factorymethod.pizzafactorymethod.pizzastore;
import factorymethod.pizzafactorymethod.chicagostylecheesepizza;
import factorymethod.pizzafactorymethod.chicagostyleclampizza;
import factorymethod.pizzafactorymethod.chicagostylepepperonipizza;
import factorymethod.pizzafactorymethod.chicagostyleveggiepizza;
class ChicagoPizzaStore : PizzaStore
{
override Pizza createPizza(string item)
{
if (item == "cheese")
{
return new ChicagoStyleCheesePizza();
}
else if (item == "veggie")
{
return new ChicagoStyleVeggiePizza();
}
else if (item == "clam")
{
return new ChicagoStyleClamPizza();
}
else if (item == "pepperoni")
{
return new ChicagoStylePepperoniPizza();
}
else
{
return null;
}
}
}