From 57e945f03e37e741a527f07fdcd84307733635e7 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Mon, 10 Feb 2025 12:53:16 +0100 Subject: [PATCH] Implement HumanA class --- ex03/HumanA.cpp | 14 +++++++++++++- ex03/HumanA.hpp | 6 +++--- ex03/Weapon.cpp | 5 +++-- ex03/Weapon.hpp | 4 ++-- ex03/main.cpp | 26 +++++++++++++++++++++++--- 5 files changed, 44 insertions(+), 11 deletions(-) diff --git a/ex03/HumanA.cpp b/ex03/HumanA.cpp index 38d2076..84dec61 100644 --- a/ex03/HumanA.cpp +++ b/ex03/HumanA.cpp @@ -6,7 +6,19 @@ /* By: dkaiser + +HumanA::HumanA(const std::string &name, Weapon &weapon) + :weapon(&weapon), + name(name) +{} + +void HumanA::attack(void) const +{ + std::cout << name << "attacks with their " << weapon->getType() << std::endl; +} diff --git a/ex03/HumanA.hpp b/ex03/HumanA.hpp index b373665..b127c67 100644 --- a/ex03/HumanA.hpp +++ b/ex03/HumanA.hpp @@ -6,7 +6,7 @@ /* By: dkaiser