CodeTheRobot

C++ Intermediate · exercise 02

Smart pointers

Own a device with std::unique_ptr and release it deliberately.

C++ Intermediate lesson 02

Guided steps

  1. 1.Create the device with std::make_unique.
  2. 2.Call use() through the pointer.
  3. 3.Call reset() and confirm the destructor ran before the final line.

Your code

Your code is saved in this browser after every run and restored next time.