Which property belongs to std::unique_ptr?
-
A
Automatic conversion to a raw pointer
-
B
Storage of objects without a deleter
-
C
Exclusive ownership that cannot be copied
Correct answer
-
D
Shared ownership counted per object
Correct answer
C. Exclusive ownership that cannot be copied
12 views
Explanation
std::unique_ptr models sole ownership and is move-only, so copying it is a compile-time error.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ