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

Method Box

Examples/NoModules/Chapter 16/Ex16_09/Box.h:9–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7{
8public:
9 Box(double l, double w, double h) : m_length{ l }, m_width{ w }, m_height{ h }
10 {
11 if (l <= 0.0 || w <= 0.0 || h <= 0.0)
12 throw DimensionError{ std::min({l, w, h}) };
13 }
14
15 double volume() const { return m_length * m_width * m_height; }
16private:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected