-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHumanB.cpp
More file actions
33 lines (27 loc) · 1.32 KB
/
Copy pathHumanB.cpp
File metadata and controls
33 lines (27 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* HumanB.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpoveda- <me@izenynn.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/15 11:28:59 by dpoveda- #+# #+# */
/* Updated: 2022/02/15 11:44:12 by dpoveda- ### ########.fr */
/* */
/* ************************************************************************** */
#include "HumanB.hpp"
#include <iostream>
HumanB::HumanB(std::string name)
: _name(name)
, _weapon(NULL) {}
HumanB::~HumanB() {}
void HumanB::attack() const {
if (_weapon != NULL) {
std::cout << this->_name << " attacks with his " << this->_weapon->getType() << std::endl;
} else {
std::cout << this->_name << " attacks with his bare hands" << std::endl;
}
}
void HumanB::setWeapon(const Weapon& weapon) {
this->_weapon = (Weapon*)&weapon;
}