| 4 | #include "Box.h" // From Ex11_04 |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | std::vector boxes{ Box{ 1.0, 2.0, 3.0 } }; // A vector containing 1 Box |
| 9 | |
| 10 | auto iter{ boxes.begin() }; |
| 11 | std::cout << iter->volume() << std::endl; // 6 == 1.0 * 2.0 * 3.0 |
| 12 | |
| 13 | *iter = Box{ 2.0, 3.0, 4.0 }; |
| 14 | std::cout << iter->volume() << std::endl; // 24 == 2.0 * 3.0 * 4.0 |
| 15 | |
| 16 | iter->setHeight(7.0); |
| 17 | std::cout << iter->volume() << std::endl; // 42 == 2.0 * 3.0 * 7.0 |
| 18 | } |