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

Function main

Examples/Modules/Chapter 15/Ex15_10/Ex15_10.cpp:5–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

volumeMethod · 0.45

Tested by

no test coverage detected