001package headfirst.factory.pizzaaf; 002 003public class VeggiePizza extends Pizza { 004 PizzaIngredientFactory ingredientFactory; 005 006 public VeggiePizza(PizzaIngredientFactory ingredientFactory) { 007 this.ingredientFactory = ingredientFactory; 008 } 009 010 void prepare() { 011 System.out.println("Preparing " + name); 012 dough = ingredientFactory.createDough(); 013 sauce = ingredientFactory.createSauce(); 014 cheese = ingredientFactory.createCheese(); 015 veggies = ingredientFactory.createVeggies(); 016 } 017}