cpp01/ex03/HumanB.cpp

26 lines
442 B
C++

#include "HumanB.hpp"
HumanB::HumanB(std::string name) : _name(name), _weapon(NULL)
{
return;
}
HumanB::~HumanB(void)
{
return;
}
void HumanB::attack()
{
if (_weapon == NULL) {
std::cout << _name << " has no weapon to attack with!" << std::endl;
return;
}
std::cout << _name << " attacks with their " << _weapon->getType() << std::endl;
}
void HumanB::setWeapon(Weapon &weapon)
{
_weapon = &weapon;
}