3. Managing flocks
The happy quackologists want to now keep track of the different flocks of birds. They'd like to be able to count the number of quacks produced by a flock, and have begun to think about other analyses they can run on our model of the little quackers.
How do we change our system to model a flock of birds. For now, almost any collection would work. We need to have an iterator (another pattern) that lets us process each of the fowl simultaneously. So, we decide to add a Flock class to our model. A flock of what? Well, it needs to be a flock of IQuackable objects.
Our diagram now looks like this:
graphic
Notice here that the Flock also implements the IQuackable interface.