Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++shared_ptr weak_ptrSingle-choice MCQ

What is wrong with this code that constructs two shared_ptrs from the same raw pointer?

Widget* raw = new Widget(); std::shared_ptr<Widget> a(raw); std::shared_ptr<Widget> b(raw);