aboutsummaryrefslogtreecommitdiff
path: root/cpp01/ex06/HumanB.cpp
blob: 7aa2a5f1890515fc3b22269abbce48c8061e8d6b (plain)
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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   HumanB.cpp                                         :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/02 16:46:02 by cacharle          #+#    #+#             */
/*   Updated: 2020/11/10 08:36:16 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "HumanB.hpp"

HumanB::HumanB(std::string const& name)
    : m_name(name), m_weapon(NULL)
{}

void HumanB::attack()
{
    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 const& weapon)
{
	m_weapon = &weapon;
}