Files
42_CPP01/ex03/src/HumanB.cpp
2023-07-19 23:26:04 +02:00

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;
}