patterns/factorymethod/pizzafactorymethod/nypizzastore.d

36 lines
871 B
D

module factorymethod.pizzafactorymethod.nypizzastore;
import factorymethod.pizzafactorymethod.pizza;
import factorymethod.pizzafactorymethod.pizzastore;
import factorymethod.pizzafactorymethod.nystylecheesepizza;
import factorymethod.pizzafactorymethod.nystyleclampizza;
import factorymethod.pizzafactorymethod.nystylepepperonipizza;
import factorymethod.pizzafactorymethod.nystyleveggiepizza;
class NYPizzaStore : PizzaStore
{
override Pizza createPizza(string item)
{
if (item == "cheese")
{
return new NYStyleCheesePizza();
}
else if (item == "veggie")
{
return new NYStyleVeggiePizza();
}
else if (item == "clam")
{
return new NYStyleClamPizza();
}
else if (item == "pepperoni")
{
return new NYStylePepperoniPizza();
}
else
{
return null;
}
}
}