Class to represent a box
| 3 | |
| 4 | // Class to represent a box |
| 5 | class Box |
| 6 | { |
| 7 | public: |
| 8 | // Constructor |
| 9 | Box(double length, double width, double height) |
| 10 | { |
| 11 | std::cout << "Box constructor called." << std::endl; |
| 12 | m_length = length; |
| 13 | m_width = width; |
| 14 | m_height = height; |
| 15 | } |
| 16 | |
| 17 | // Function to calculate the volume of a box |
| 18 | double volume() |
| 19 | { |
| 20 | return m_length * m_width * m_height; |
| 21 | } |
| 22 | |
| 23 | private: |
| 24 | double m_length {1.0}; |
| 25 | double m_width {1.0}; |
| 26 | double m_height {1.0}; |
| 27 | }; |
| 28 | |
| 29 | int main() |
| 30 | { |
nothing calls this directly
no outgoing calls
no test coverage detected