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.
2022-11-11 22:22:12 +00:00
|
|
|
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)
|
|
|
|
{
|
2022-11-11 22:24:33 +00:00
|
|
|
Pizza pizza = null;
|
2022-11-11 22:22:12 +00:00
|
|
|
|
2022-11-11 22:24:33 +00:00
|
|
|
if (type == "cheese")
|
2022-11-11 22:22:12 +00:00
|
|
|
{
|
2022-11-11 22:24:33 +00:00
|
|
|
pizza = new CheesePizza();
|
|
|
|
}
|
2022-11-11 22:22:12 +00:00
|
|
|
else if (type == "pepperoni")
|
|
|
|
{
|
2022-11-11 22:24:33 +00:00
|
|
|
pizza = new PepperoniPizza();
|
|
|
|
}
|
2022-11-11 22:22:12 +00:00
|
|
|
else if (type == "clam")
|
|
|
|
{
|
2022-11-11 22:24:33 +00:00
|
|
|
pizza = new ClamPizza();
|
|
|
|
}
|
2022-11-11 22:22:12 +00:00
|
|
|
else if (type == "veggie")
|
|
|
|
{
|
2022-11-11 22:24:33 +00:00
|
|
|
pizza = new VeggiePizza();
|
|
|
|
}
|
|
|
|
return pizza;
|
|
|
|
}
|
2022-11-11 22:22:12 +00:00
|
|
|
}
|