34 lines
534 B
C++
34 lines
534 B
C++
#include "HumanB.hpp"
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
HumanB::HumanB(const std::string& name)
|
|
{
|
|
std::cout << "HumanB()" << std::endl;
|
|
this->_name = name;
|
|
this->_weapon = NULL;
|
|
}
|
|
|
|
HumanB::~HumanB()
|
|
{
|
|
std::cout << "~HumanB()" << std::endl;
|
|
}
|
|
|
|
void HumanB::attack()
|
|
{
|
|
std::cout << this->_name << " attacks with their ";
|
|
if (this->_weapon == NULL)
|
|
std::cout << "hands";
|
|
else
|
|
std::cout << this->_weapon->getType();
|
|
std::cout << std::endl;
|
|
}
|
|
|
|
void HumanB::setWeapon(const Weapon &weapon)
|
|
{
|
|
this->_weapon = &weapon;
|
|
}
|
|
|
|
|