| 2 | #define BOX_H |
| 3 | |
| 4 | class Box |
| 5 | { |
| 6 | public: |
| 7 | // Constructors |
| 8 | Box() = default; |
| 9 | Box(double length, double width, double height); |
| 10 | |
| 11 | double volume() const; // Function to calculate the volume of a box |
| 12 | void printVolume() const; // Function to print out the volume of a box (const!) |
| 13 | |
| 14 | // Functions to provide access to the values of member variables (all const!) |
| 15 | double getLength() const { return m_length; } |
| 16 | double getWidth() const { return m_width; } |
| 17 | double getHeight() const { return m_height; } |
| 18 | |
| 19 | // Functions to set member variable values (not const!) |
| 20 | void setLength(double length) { if (length > 0) m_length = length; } |
| 21 | void setWidth(double width) { if (width > 0) m_width = width; } |
| 22 | void setHeight(double height) { if (height > 0) m_height = height; } |
| 23 | |
| 24 | private: |
| 25 | double m_length{1.0}; |
| 26 | double m_width {1.0}; |
| 27 | double m_height{1.0}; |
| 28 | mutable unsigned m_count{}; // Counts the amount of time printVolume() is called |
| 29 | }; |
| 30 | |
| 31 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected