What's the correct way to set up a data structure for the following, using sound OO and design-pattern methods?
1. I have an class hierarchy for zoo animals, including FourLeggedAnimals, TwoLeggedAnimals, AnimalWithBeaks, etc etc.
2. I want to print out a table of all my zoo animals
3. For any animal that has a beak, I want the table to show what colour their beak is
I want the animals to be stored in a vector<ZooAnimal *>, and I want an iterator to be used to move through the list of animals. How can I access methods that are particular to AnimalWithBeak given that my pointer is to an object of type 'ZooAnimal'? What is the correct approach?
Thanks in advance!