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

Function main

Exercises/NoModules/Chapter 15/Soln15_06/Soln15_06.cpp:10–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8void printSums(const std::vector<Shape*>& shapes);
9
10int main()
11{
12 Circle c1{ Point{1, 1}, 1 };
13 Circle c2{ Point{2, 2}, 2 };
14 Circle c3{ Point{3, 3}, 3 };
15 Rectangle r1{ {4, 5}, 4, 5 }; // Shorter notation (omitted Point type) could of course be used for Circles as well!
16 Rectangle r2{ {6, 7}, 6, 7 };
17 Rectangle r3{ {8, 9}, 8, 9 };
18
19 std::vector<Shape*> shapes{ &c1, &r1, &r2, &c2, &c3, &r3 };
20
21 printSums(shapes);
22
23 for (auto* shape : shapes) shape->scale(1.5);
24
25 std::cout << std::endl;
26 printSums(shapes);
27}
28
29double calculateSumAreas(const std::vector<Shape*>& shapes)
30{

Callers

nothing calls this directly

Calls 2

printSumsFunction · 0.70
scaleMethod · 0.45

Tested by

no test coverage detected