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

Method showAnimals

Exercises/Modules/Chapter 15/Soln15_05/Zoo.cpp:20–26  ·  view source on GitHub ↗

Output the animals and the sound they make

Source from the content-addressed store, hash-verified

18
19// Output the animals and the sound they make
20void 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)
29std::vector<SheepPtr> Zoo::herd() const

Callers 1

mainFunction · 0.45

Calls 2

whoMethod · 0.45
soundMethod · 0.45

Tested by

no test coverage detected