unique_ptr<Player> pPlayer = make_unique<Player>();
unique_ptr<Monster> pMonster = make_unique<Monster>();

RAII 원칙 적용 → scope 끝나면 자동 delete 객체 소유권이 명확 (unique_ptr = 하나만 소유함)

Heap 영역에 올려 동적 객체로 쓰면서, 해제 걱정을 하지 않기 위해..

image.png

image.png

image.png

image.png

image.png

이제 이렇게 써주고 std::move 로 소유권을 Player 클래스로 이전하면된다.

image.png

image.png

image.png