35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* HumanB.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
|
|
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "HumanB.hpp"
|
|
|
|
HumanB::HumanB(const std::string &name)
|
|
: name(name), weapon(NULL) {}
|
|
|
|
void HumanB::attack() const
|
|
{
|
|
if (weapon)
|
|
{
|
|
std::cout << this->name << " attacks with their "
|
|
<< this->weapon->getType()
|
|
<< std::endl;
|
|
} else {
|
|
std::cout << this->name << " has no weapon"
|
|
<< std::endl;
|
|
}
|
|
}
|
|
|
|
void HumanB::setWeapon(Weapon &w)
|
|
{
|
|
this->weapon = &w;
|
|
}
|