001package headfirst.combining.composite; 002 003public class CountingDuckFactory extends AbstractDuckFactory { 004 005 public Quackable createMallardDuck() { 006 return new QuackCounter(new MallardDuck()); 007 } 008 009 public Quackable createRedheadDuck() { 010 return new QuackCounter(new RedheadDuck()); 011 } 012 013 public Quackable createDuckCall() { 014 return new QuackCounter(new DuckCall()); 015 } 016 017 public Quackable createRubberDuck() { 018 return new QuackCounter(new RubberDuck()); 019 } 020}