33 lines
1.3 KiB
C++
33 lines
1.3 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* HumanB.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/04/20 17:02:21 by erey-bet #+# #+# */
|
|
/* Updated: 2023/04/20 17:32:17 by erey-bet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "HumanB.hpp"
|
|
|
|
HumanB::HumanB(std::string name): weapon(NULL) {
|
|
this->name = name;
|
|
}
|
|
|
|
HumanB::HumanB(std::string name, Weapon &weapon): weapon(&weapon) {
|
|
this->name = name;
|
|
}
|
|
|
|
void HumanB::attack(void) {
|
|
if (weapon == NULL)
|
|
std::cout << name + " attacks with their fist"<< std::endl;
|
|
else
|
|
std::cout << name + " attacks with their " + weapon->getType() << std::endl;
|
|
}
|
|
|
|
void HumanB::setWeapon(Weapon &weapon) {
|
|
this->weapon = &weapon;
|
|
}
|