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

Function main

Exercises/Modules/Chapter 15/Soln15_06/Soln15_06.cpp:11–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

printSumsFunction · 0.70
scaleMethod · 0.45

Tested by

no test coverage detected