patterns/abstractfactory/veggiepizza.d

25 lines
615 B
D

module abstractfactory.veggiepizza;
import abstractfactory.pizza;
import abstractfactory.pizzaingredientfactory;
import std.stdio : writeln;
class VeggiePizza : 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();
}
}