001package headfirst.factory.pizzaaf;
002
003public class CheesePizza extends Pizza {
004        PizzaIngredientFactory ingredientFactory;
005
006        public CheesePizza(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        }
016}