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

Function main

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

Source from the content-addressed store, hash-verified

3#include "Box.h"
4
5int main()
6{
7 const Box box1 {2.0, 3.0, 4.0}; // An arbitrary box
8 Box box2 {5.0}; // A box that is a cube
9 std::cout << "box1 volume = " << box1.volume() << std::endl;
10 std::cout << "box2 volume = " << box2.volume() << std::endl;
11 Box box3 {box2};
12 std::cout << "box3 volume = " << box3.volume() << std::endl; // Volume = 125
13
14 std::cout << std::endl;
15
16 Box boxes[6] {box1, box2, box3, Box {2.0}};
17
18 std::cout << "\nThere are now " << box1.getObjectCount() << " Box objects.\n";
19}

Callers

nothing calls this directly

Calls 2

volumeMethod · 0.45
getObjectCountMethod · 0.45

Tested by

no test coverage detected