The issue is having a homogenous collection of base objects, but
needing to perform class-specific functions only on those of a
specific type inside it.
Cat, Dog, and Bird all derive from the Animal class
There is an array, Animal[]
Only Dog can Fetch().
I need to cause all dogs in Animal to Fetch()
It's been said that using instanceof is the sign of a bad design.
However, my solution was basically:
1) Go through Animal[] and create a list of instanceof Dog
2) Go through the Dog list and call Fetch()
Is there a better way? It doesn't really make sense to make
Animal.Fetch() and then only Dog override it.