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/pizzasimple/pizzastore.d

29 lines
503 B
D
Raw Normal View History

2022-11-11 22:22:12 +00:00
module factorymethod.pizzasimple.pizzastore;
import factorymethod.pizzasimple.simplepizzafactory;
import factorymethod.pizzasimple.pizza;
class PizzaStore
{
SimplePizzaFactory factory;
this(SimplePizzaFactory factory)
{
2022-11-11 22:24:33 +00:00
this.factory = factory;
2022-11-11 22:22:12 +00:00
}
Pizza orderPizza(string type)
{
2022-11-11 22:24:33 +00:00
Pizza pizza;
2022-11-11 22:22:12 +00:00
2022-11-11 22:24:33 +00:00
pizza = factory.createPizza(type);
2022-11-11 22:22:12 +00:00
2022-11-11 22:24:33 +00:00
pizza.prepare();
pizza.bake();
pizza.cut();
pizza.box();
2022-11-11 22:22:12 +00:00
2022-11-11 22:24:33 +00:00
return pizza;
}
2022-11-11 22:22:12 +00:00
}