Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint: Object-Oriented Design

โญโญ intermediateโณ 30 min read๐Ÿ“ Lesson 79 of 204

One type combining encapsulated state, a shared static counter, and a const-correct read-only surface.

This checkpoint asks for one small type that gets four things right at once:

  1. Encapsulation โ€” the vector of titles is private; operations are the only door.
  2. Instance vs class state โ€” each Library has its own titles; total_copies() is shared.
  3. Const correctness โ€” size()/has() work through a const Library&.
  4. Pass-by-move โ€” add(std::string title) takes by value and moves in (one parameter serves both lvalues and rvalues).

Aim for the shortest implementation that satisfies all four tests.