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/nypizzastore.d

36 lines
871 B
D
Raw Normal View History

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