-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScavTrap.cpp
48 lines (41 loc) · 1.88 KB
/
ScavTrap.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ScavTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aperez-b <aperez-b@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/22 17:38:33 by aperez-b #+# #+# */
/* Updated: 2022/09/29 15:27:49 by aperez-b ### ########.fr */
/* */
/* ************************************************************************** */
#include "ScavTrap.hpp"
ScavTrap::ScavTrap(void)
{
std::cout << "ScavTrap from ClapTrap " << this->_name << " created with default constructor." << std::endl;
}
ScavTrap::ScavTrap(std::string const &name): ClapTrap(name)
{
std::cout << "ScavTrap from ClapTrap " << this->_name << " created." << std::endl;
}
ScavTrap::~ScavTrap(void)
{
std::cout << "ScavTrap from ClapTrap " << this->_name << " destroyed." << std::endl;
}
ScavTrap::ScavTrap(ScavTrap const ©): ClapTrap(copy)
{
std::cout << "ScavTrap from ClapTrap " << this->_name << " copied." << std::endl;
}
ScavTrap &ScavTrap::operator=(ScavTrap const ©)
{
std::cout << "Assignment operator for ScavTrap called." << std::endl;
ClapTrap::operator=(copy);
return (*this);
}
void ScavTrap::guardGate(void)
{
if (this->_hp <= 0)
std::cout << "Cannot switch to gate-keeper mode because: ClapTrap " << this->_name << " is dead." << std::endl;
else
std::cout << "ScavTrap from ClapTrap " << this->_name << " switched to mode: \"Guard Gate\"." << std::endl;
}