Intermediate
C++
Q43 / 100
What is the difference between unique_ptr and shared_ptr?
Correct! Well done.
Incorrect.
The correct answer is B) unique_ptr enforces exclusive ownership (non-copyable); shared_ptr allows shared ownership via reference counting
B
Correct Answer
unique_ptr enforces exclusive ownership (non-copyable); shared_ptr allows shared ownership via reference counting
Explanation
unique_ptr is zero-overhead exclusive ownership. shared_ptr maintains a reference count and deletes the object when the count reaches 0.
Progress
43/100