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

Function main

Examples/NoModules/Chapter 15/Ex15_10/Ex15_10.cpp:7–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "Carton.h" // For the Carton class
6
7int main()
8{
9 // Box box{20.0, 30.0, 40.0}; // Uncomment for compiler error
10
11 ToughPack hardcase {20.0, 30.0, 40.0}; // A derived box - same size
12 Carton carton {20.0, 30.0, 40.0, "plastic"}; // A different derived box
13
14 Box*pBox {&hardcase}; // Base pointer - derived address
15 std::cout << "hardcase volume is " << pBox->volume() << std::endl;
16
17 pBox = &carton; // New derived address
18 std::cout << "carton volume is " << pBox->volume() << std::endl;
19}

Callers

nothing calls this directly

Calls 1

volumeMethod · 0.45

Tested by

no test coverage detected