MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / showAnimals

Method showAnimals

Exercises/NoModules/Chapter 15/Soln15_05/Zoo.cpp:18–24  ·  view source on GitHub ↗

Output the animals and the sound they make

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.45

Calls 2

whoMethod · 0.45
soundMethod · 0.45

Tested by

no test coverage detected