๐ 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:
- Encapsulation โ the vector of titles is private; operations are the only door.
- Instance vs class state โ each
Libraryhas its own titles;total_copies()is shared. - Const correctness โ
size()/has()work through aconst Library&. - 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.