001package headfirst.combining.factory;
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
020        public String toString() {
021                return duck.toString();
022        }
023}