cpp01/ex03/HumanB.cpp

16 lines
404 B
C++
Raw Normal View History

2025-05-12 14:00:11 +02:00
#include "HumanB.hpp"
#include <iostream>
HumanB::HumanB(std::string name) : name(name) { this->weapon = NULL; }
void HumanB::setWeapon(Weapon &weapon) { this->weapon = &weapon; }
void HumanB::attack(void) {
std::string weaponType;
if (weapon != NULL)
weaponType = weapon->getType();
else
weaponType = "hands";
std::cout << name << " attacks with their " << weaponType << std::endl;
}