class A
{
Foo* pFoo;
public:
A(): pFoo(new Foo(42)) {}
A(A& other): pFoo(other.pFoo) { other.pFoo = nullptr; }
A& operator=(A& other) { std::swap(this->pFoo, other.pFoo); }
~A() { delete pFoo; }
};

class A
{
std::unique_ptr<Foo> pFoo;
public:
A(): pFoo(std::make_unique<Foo>(42)) {}
};

どっちが間違えにくいかなんて明白だろ
「俺は間違えない」「間違える低能が悪い」とか抜かす奴はソフト品質の勉強してくれ