Skip to main content

RAII Owner

Challenge on lesson: Checkpoint: RAII

CHALLENGE
Difficulty: beginner+25 XP

Implement class IntBox: constructor explicit IntBox(int value) stores a heap int (using new โ€” the one sanctioned place), get() const returns the value, destructor frees it. Deleting copy construction/assignment is required. Then implement make_doubled(int) returning std::unique_ptr<IntBox> holding the doubled value.

Back to lesson: Checkpoint: RAII