42_CPP01/ex03/src/HumanA.cpp
2023-07-18 03:20:06 +02:00

38 lines
592 B
C++

#include "HumanA.hpp"
#include <iostream>
#include <string>
HumanA::HumanA(const std::string& name, const Weapon& weapon)
{
this->_name = name;
this->_weapon = weapon;
}
HumanA::HumanA()
{
std::cout << "HumanA()" << std::endl;
}
HumanA::HumanA(const HumanA& src)
{
*this = src;
}
HumanA::~HumanA()
{
std::cout << "~HumanA()" << std::endl;
}
HumanA& HumanA::operator=(const HumanA& src)
{
this->_weapon = src._weapon;
this->_name = src._name;
return *this;
}
void HumanA::attack()
{
std::cout << this->_name << " attacks with their " << this->_weapon.getType() << std::endl;
}