We solved the flying problem by having the Rubber Duck subclass (and now the new Decoy Duck subclass) override the fly() methods with their own implementations that do nothing. We ran into another gotcha with the quack() method, since rubber ducks squeak and decoys make no sound at all. The problem now is maintenance. We now have all these different implementations of methods buried in our objects. Code reuse has gone out the window.

download: source code

Mallard Duck
Display:
Swim: This duck is swimming.
Quack: Quack!
Fly: I'm flying!
Redhead Duck
Display:
Swim: This duck is swimming.
Quack: Quack!
Fly: I'm flying!
Rubber Duck
Display:
Swim: This duck is swimming.
Quack: Squeak!
Fly:
Decoy Duck
Display:
Swim: This duck is swimming.
Quack:
Fly: