#include "Monster.h" #include Monster::Monster() : _pWeapon(new Weapon()) { //ToString(); std::cout << "Monster::Monster()" << std::endl; } Monster::Monster(const Monster& other) { // shallow copy this->_name = other._name; //this->_pWeapon = other._pWeapon; // deep copy this->_pWeapon = new Weapon(*other._pWeapon); } Monster::~Monster() { std::cout << "Monster::~Monster()" << std::endl; if (_pWeapon != nullptr) { delete _pWeapon; _pWeapon = nullptr; } }