aboutsummaryrefslogtreecommitdiff
path: root/cpp01/ex06/HumanB.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-09 11:26:50 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-09 11:26:50 +0100
commitb799c007a1b6911fcbe5141429ea541e1277ebdd (patch)
treed70ad0826ad2fc2d635adf9afecf89af0838d20b /cpp01/ex06/HumanB.cpp
parent1e9d90bdf9ef5fc05093d3449d883597c7f896de (diff)
downloadpiscine_cpp-b799c007a1b6911fcbe5141429ea541e1277ebdd.tar.gz
piscine_cpp-b799c007a1b6911fcbe5141429ea541e1277ebdd.tar.bz2
piscine_cpp-b799c007a1b6911fcbe5141429ea541e1277ebdd.zip
Fixing some edge cases in cpp00 and cpp01, Updated formatting
Diffstat (limited to 'cpp01/ex06/HumanB.cpp')
-rw-r--r--cpp01/ex06/HumanB.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/cpp01/ex06/HumanB.cpp b/cpp01/ex06/HumanB.cpp
index 98774aa..e6adb22 100644
--- a/cpp01/ex06/HumanB.cpp
+++ b/cpp01/ex06/HumanB.cpp
@@ -6,20 +6,22 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/02 16:46:02 by cacharle #+# #+# */
-/* Updated: 2020/04/13 10:25:54 by charles ### ########.fr */
+/* Updated: 2020/11/09 11:13:34 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "HumanB.hpp"
-HumanB::HumanB(std::string name)
+HumanB::HumanB(std::string const& name)
: m_name(name), m_weapon(NULL)
-{
-}
+{}
void HumanB::attack()
{
- std::cout << m_name << " attack with his " << m_weapon->getType() << std::endl;
+ if (m_weapon == NULL)
+ std::cout << m_name << " doesn't have any weapon " << std::endl;
+ else
+ std::cout << m_name << " attack with his " << m_weapon->getType() << std::endl;
}
void HumanB::setWeapon(Weapon& weapon)