You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.2 KiB

3 years ago
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* HumanB.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/16 09:13:28 by narnaud #+# #+# */
/* Updated: 2022/07/18 10:05:32 by narnaud ### ########.fr */
3 years ago
/* */
/* ************************************************************************** */
#include "HumanB.hpp"
HumanB::HumanB(string name):_name(name), _weapon(NULL){}
HumanB::HumanB(string name, Weapon &weap):_name(name), _weapon(&weap){}
void HumanB::attack(void) const {
3 years ago
std::cout << _name << " attacks with their ";
if (_weapon)
cout << _weapon->getType() << endl;
else
cout << "fists\n";
}
void HumanB::setWeapon(Weapon &weap) {
3 years ago
_weapon = &weap;
}