34 lines
699 B
D
34 lines
699 B
D
module factorymethod.pizzasimple.simplepizzafactory;
|
|
|
|
import factorymethod.pizzasimple.pizza;
|
|
import factorymethod.pizzasimple.cheesepizza;
|
|
import factorymethod.pizzasimple.pepperonipizza;
|
|
import factorymethod.pizzasimple.clampizza;
|
|
import factorymethod.pizzasimple.veggiepizza;
|
|
|
|
class SimplePizzaFactory
|
|
{
|
|
Pizza createPizza(string type)
|
|
{
|
|
Pizza pizza = null;
|
|
|
|
if (type == "cheese")
|
|
{
|
|
pizza = new CheesePizza();
|
|
}
|
|
else if (type == "pepperoni")
|
|
{
|
|
pizza = new PepperoniPizza();
|
|
}
|
|
else if (type == "clam")
|
|
{
|
|
pizza = new ClamPizza();
|
|
}
|
|
else if (type == "veggie")
|
|
{
|
|
pizza = new VeggiePizza();
|
|
}
|
|
return pizza;
|
|
}
|
|
}
|