feat(ex03): it works
This commit is contained in:
parent
8f7b9c3068
commit
28784b50f0
9 changed files with 153 additions and 0 deletions
15
ex03/HumanB.cpp
Normal file
15
ex03/HumanB.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue