Files
cpp03/ex02/FragTrap/FragTrap.cpp

58 lines
1.8 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* FragTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "FragTrap.hpp"
FragTrap::FragTrap() : ClapTrap("(NULL)")
{
this->health = 100;
this->energy = 100;
this->attackDamage = 30;
std::cout << "FragTrap default constructor called " << this->name
<< std::endl;
}
FragTrap::FragTrap(std::string name) : ClapTrap(name)
{
this->health = 100;
this->energy = 100;
this->attackDamage = 30;
std::cout << "FragTrap constructor called " << this->name
<< std::endl;
}
FragTrap::FragTrap(const FragTrap &other) : ClapTrap(other) { }
FragTrap& FragTrap::operator=(const FragTrap &other)
{
if (this != &other)
{
this->name = other.name;
this->health = other.health;
this->energy = other.energy;
this->attackDamage = other.attackDamage;
}
return (*this);
}
FragTrap::~FragTrap()
{
std::cout << "FragTrap destructor called for "
<< this->name << std::endl;
}
void FragTrap::highFivesGuys(void)
{
std::cout << "FragTrap " << this->name << " has requested a high-five!"
<< std::endl;
}