| 3 | #include <iostream> |
| 4 | |
| 5 | class Box |
| 6 | { |
| 7 | public: |
| 8 | Box(double length, double width, double height) |
| 9 | : m_length {length}, m_width {width}, m_height {height} |
| 10 | { |
| 11 | std::cout << "Box constructor called for a Box of volume " << volume() << std::endl; |
| 12 | } |
| 13 | virtual ~Box() |
| 14 | { |
| 15 | std::cout << "Box destructor called for a Box of volume " << volume() << std::endl; |
| 16 | } |
| 17 | |
| 18 | // Function to calculate volume of a Box |
| 19 | virtual double volume() const { return m_length * m_width * m_height; } |
| 20 | |
| 21 | void showVolume() const |
| 22 | { |
| 23 | std::cout << "The volume from inside Box::showVolume() is " |
| 24 | << volume() << std::endl; |
| 25 | } |
| 26 | |
| 27 | private: |
| 28 | double m_length, m_width, m_height; |
| 29 | }; |
| 30 | |
| 31 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected