001package headfirst.combining.decorator; 002 003public class QuackCounter implements Quackable { 004 Quackable duck; 005 static int numberOfQuacks; 006 007 public QuackCounter (Quackable duck) { 008 this.duck = duck; 009 } 010 011 public void quack() { 012 duck.quack(); 013 numberOfQuacks++; 014 } 015 016 public static int getQuacks() { 017 return numberOfQuacks; 018 } 019 public String toString() { 020 return duck.toString(); 021 } 022}