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

Function main

Examples/NoModules/Chapter 20/Ex20_08/Ex20_08.cpp:6–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "Box.h" // From Ex11_04
5
6int main()
7{
8 std::vector boxes{ Box{ 1.0, 2.0, 3.0 } }; // A vector containing 1 Box
9
10 auto iter{ boxes.begin() };
11 std::cout << iter->volume() << std::endl; // 6 == 1.0 * 2.0 * 3.0
12
13 *iter = Box{ 2.0, 3.0, 4.0 };
14 std::cout << iter->volume() << std::endl; // 24 == 2.0 * 3.0 * 4.0
15
16 iter->setHeight(7.0);
17 std::cout << iter->volume() << std::endl; // 42 == 2.0 * 3.0 * 7.0
18}

Callers

nothing calls this directly

Calls 2

volumeMethod · 0.45
setHeightMethod · 0.45

Tested by

no test coverage detected