feat(ex02): it works
This commit is contained in:
parent
6254cbc7bd
commit
5cd051a7f7
9 changed files with 254 additions and 0 deletions
32
ex02/ScavTrap.cpp
Normal file
32
ex02/ScavTrap.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "ScavTrap.hpp"
|
||||
#include <iostream>
|
||||
|
||||
ScavTrap::ScavTrap() {
|
||||
std::cout << "ScavTrap::ScavTrap()" << std::endl;
|
||||
hit_points = 100;
|
||||
energy_points = 50;
|
||||
attack_damage = 20;
|
||||
}
|
||||
|
||||
ScavTrap::ScavTrap(std::string name) {
|
||||
std::cout << "ScavTrap::ScavTrap(" << name << ")" << std::endl;
|
||||
hit_points = 100;
|
||||
energy_points = 50;
|
||||
attack_damage = 20;
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
ScavTrap::~ScavTrap() { std::cout << "ScavTrap::~ScavTrap()" << std::endl; }
|
||||
|
||||
ScavTrap &ScavTrap::operator=(const ScavTrap &other) {
|
||||
this->hit_points = other.hit_points;
|
||||
this->energy_points = other.energy_points;
|
||||
this->attack_damage = other.attack_damage;
|
||||
this->name = other.name;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ScavTrap::guardGate() {
|
||||
std::cout << "ScavTrap " << name << " is now in gate-guarding mode."
|
||||
<< std::endl;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue