This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/factorymethod/pizzafactorymethod/chicagopizzastore.d

36 lines
921 B
D
Raw Normal View History

2022-11-12 19:47:14 +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;
}
}
}