Menu

[Solved]Class Name Public Name Private String Name Cs Weakptr Wptr Shareptr Sptr Nullptr Void Func Q37271535

class Name { public: Name() {} private: string name{ “CS” };};

weak_ptr wPtr;

share_ptr sPtr{nullptr};

void func() { unique_ptr obj { make_unique() };

// #1 Insert Code } int main() {

// #2 Insert Code return 0;

} [ #1 Insert Code]:

Write code to keep the object which obj owns alive outside ofthe scope of func and wPtr reference obj. [ #2 Insert Code]:

Write code to test if wPtr is dangling. Is it dangling ornot?

Expert Answer


Answer to class Name { public: Name() {} private: string name{ “CS” }; }; weak_ptr wPtr; share_ptr sPtr{nullptr}; void func() { un… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *