| 4 | import box; |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | Box box1 {2.2, 1.1, 0.5}; // An arbitrary box |
| 9 | Box box2; // A default box |
| 10 | auto box3{ std::make_unique<Box>(15.0, 20.0, 8.0) }; // Dynamically allocated Box |
| 11 | |
| 12 | std::cout << "Volume of box1 = " << box1.volume() << std::endl; |
| 13 | std::cout << "Surface area of box1 = " << surfaceArea(box1) << std::endl; |
| 14 | |
| 15 | std::cout << "Volume of box2 = "<< box2.volume() << std::endl; |
| 16 | std::cout << "Surface area of box2 = " << surfaceArea(box2) << std::endl; |
| 17 | |
| 18 | std::cout << "Volume of box3 = " << box3->volume() << std::endl; |
| 19 | std::cout << "Surface area of box3 = " << surfaceArea(*box3) << std::endl; |
| 20 | } |
| 21 | |
| 22 | // friend function to calculate the surface area of a Box object |
| 23 | double surfaceArea(const Box& box) |
nothing calls this directly
no test coverage detected