patterns/abstractfactory/pepperonipizza.d

26 lines
678 B
D

module abstractfactory.pepperonipizza;
import abstractfactory.pizza;
import abstractfactory.pizzaingredientfactory;
import std.stdio : writeln;
class PepperoniPizza : Pizza
{
PizzaIngredientFactory ingredientFactory;
this(PizzaIngredientFactory ingredientFactory)
{
this.ingredientFactory = ingredientFactory;
}
override void prepare()
{
writeln("Preparing ", name);
dough = ingredientFactory.createDough();
sauce = ingredientFactory.createSauce();
cheese = ingredientFactory.createCheese();
veggies = ingredientFactory.createVeggies();
pepperoni = ingredientFactory.createPepperoni();
}
}