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

Function main

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

Source from the content-addressed store, hash-verified

5#include "CerealPack.h" // For the CerealPack class
6
7int main()
8{
9 CerealPack cornflakes{ 8.0, 3.0, 10.0, "Cornflakes" };
10
11 std::cout << "cornflakes volume is " << cornflakes.volume() << std::endl
12 << "cornflakes weight is " << cornflakes.getWeight() << std::endl;
13/*
14 // Here is one way to make this work (see Ex14_07A and B for alternatives)
15 std::cout << "cornflakes volume is " << cornflakes.Carton::volume() << std::endl
16 << "cornflakes weight is " << cornflakes.FoodContainer::getWeight()
17 << std::endl;
18*/
19}

Callers

nothing calls this directly

Calls 2

volumeMethod · 0.45
getWeightMethod · 0.45

Tested by

no test coverage detected