Output the animals and the sound they make
| 18 | |
| 19 | // Output the animals and the sound they make |
| 20 | void Zoo::showAnimals() const |
| 21 | { |
| 22 | for (const auto& animal : m_animals) |
| 23 | { |
| 24 | std::cout << animal->who() << ' ' << animal->sound() << std::endl; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // Collect all Sheep in the Zoo using dynamic cast (the recommended way) |
| 29 | std::vector<SheepPtr> Zoo::herd() const |