From: Dominik Kaiser Date: Mon, 10 Feb 2025 12:00:31 +0000 (+0100) Subject: Implement HumanB class X-Git-Url: https://git.dkaiser.de/?a=commitdiff_plain;h=eaf8c2c6840386a9610c165447357cdd98a77d26;p=42%2Fcpp01.git Implement HumanB class --- diff --git a/ex03/HumanA.cpp b/ex03/HumanA.cpp index 84dec61..e7b6411 100644 --- a/ex03/HumanA.cpp +++ b/ex03/HumanA.cpp @@ -6,7 +6,7 @@ /* By: dkaiser getType() << std::endl; + std::cout << name << " attacks with their "; + std::cout << weapon->getType() << std::endl; } diff --git a/ex03/HumanB.cpp b/ex03/HumanB.cpp index 4550c59..fad3f78 100644 --- a/ex03/HumanB.cpp +++ b/ex03/HumanB.cpp @@ -6,7 +6,24 @@ /* By: dkaiser + +HumanB::HumanB(const std::string &name) + :name(name) +{} + +void HumanB::attack(void) const +{ + std::cout << name << " attacks with their "; + std::cout << weapon->getType() << std::endl; +} + +void HumanB::setWeapon(Weapon &weapon) +{ + this->weapon = &weapon; +} diff --git a/ex03/HumanB.hpp b/ex03/HumanB.hpp index ce4edbd..c22b5c4 100644 --- a/ex03/HumanB.hpp +++ b/ex03/HumanB.hpp @@ -6,7 +6,7 @@ /* By: dkaiser