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

Function main

Examples/NoModules/Chapter 12/Ex12_16/Ex12_16.cpp:5–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include "Box.h"
4
5int main()
6{
7 std::cout << "There are now " << Box::getObjectCount() << " Box objects." << std::endl;
8
9 const Box box1 {2.0, 3.0, 4.0}; // An arbitrary box
10 Box box2 {5.0}; // A box that is a cube
11
12 std::cout << "There are now " << Box::getObjectCount() << " Box objects." << std::endl;
13
14 for (double d {} ; d < 3.0 ; ++d)
15 {
16 Box box {d, d + 1.0, d + 2.0};
17 std::cout << "Box volume is " << box.volume() << std::endl;
18 }
19
20 std::cout << "There are now " << Box::getObjectCount() << " Box objects." << std::endl;
21
22 auto pBox{ std::make_unique<Box>(1.5, 2.5, 3.5) };
23 std::cout << "Box volume is " << pBox->volume() << std::endl;
24 std::cout << "There are now " << pBox->getObjectCount() << " Box objects." << std::endl;
25}

Callers

nothing calls this directly

Calls 2

volumeMethod · 0.45
getObjectCountMethod · 0.45

Tested by

no test coverage detected