Skip to main content

Counter and Shapes

Challenge on lesson: Checkpoint: OOP

Implement class Counter with: a constructor taking an initial value (default 0), inc() (+1), reset() (back to the value it was constructed with), and value() const. The count must never go below the initial value (inc past it is fine). Then implement total_area(const std::vector<std::unique_ptr<Shape>>&) given the Shape/Circle/Square definitions in the boilerplate.

Difficulty: beginner

Back to lesson: Checkpoint: OOP