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

Method volume

Examples/NoModules/Chapter 15/Ex15_04/Box.h:16–20  ·  view source on GitHub ↗

Function to calculate the volume of a Box object

Source from the content-addressed store, hash-verified

14
15 // Function to calculate the volume of a Box object
16 virtual double volume(int i = 5) const
17 {
18 std::cout << "(Box argument = " << i << ") ";
19 return m_length * m_width * m_height;
20 }
21
22protected: // Should be private in production-quality code (add getters to access)
23 double m_length, m_width, m_height;

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected