001package headfirst.combining.observer;
002
003public class RedheadDuck implements Quackable {
004        Observable observable;
005
006        public RedheadDuck() {
007                observable = new Observable(this);
008        }
009
010        public void quack() {
011                System.out.println("Quack");
012                notifyObservers();
013        }
014
015        public void registerObserver(Observer observer) {
016                observable.registerObserver(observer);
017        }
018
019        public void notifyObservers() {
020                observable.notifyObservers();
021        }
022
023        public String toString() {
024                return "Redhead Duck";
025        }
026}