TheExample_img1.gif 1. The Example
We're going to help the National Association of Quackologists (NAQ) in their quest to learn about ducks and geese. They want to increase their knowledge of the behavior of the feathery creatures, such as how many quacks they produce, the type of quacks, and so on.
The first thing we're going to do is create a Quackable interface and some appropriate duck classes that implement the interface. The class diagram looks like this:
graphic
You can imagine that the different implementations of Quack() would produce different types of quacks, like "quack", "kwak", "squeak", and so on.