mastring the simple heritage
This commit is contained in:
parent
245ac4c3a9
commit
d161579a2a
13 changed files with 376 additions and 4 deletions
0
cpp03/ex01/FragTrap.cpp
Normal file
0
cpp03/ex01/FragTrap.cpp
Normal file
0
cpp03/ex01/FragTrap.hpp
Normal file
0
cpp03/ex01/FragTrap.hpp
Normal file
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/24 17:41:01 by rparodi #+# #+# */
|
||||
/* Updated: 2025/01/24 18:31:52 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/01/24 20:31:45 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,5 +17,11 @@ ScavTrap::ScavTrap (std::string name) {
|
|||
_hit_point = 100;
|
||||
_energy_point = 50;
|
||||
_attack_damage = 20;
|
||||
_gateKeeperMode = false;
|
||||
std::cout << "\n[Init] ScavTrap:\n\t" << "Name: " << _name << std::endl;
|
||||
}
|
||||
|
||||
void ScavTrap::guardGate() {
|
||||
_gateKeeperMode = !_gateKeeperMode;
|
||||
std::cout << "\n[Mode] ScavTrap:\n\t" << "Name: " << _name << " the mode gate keeper is now: " << (_gateKeeperMode ? "enable" : "disable") << std::endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/20 23:13:16 by rparodi #+# #+# */
|
||||
/* Updated: 2025/01/24 18:23:14 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/01/24 18:46:42 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,10 +19,11 @@
|
|||
class ScavTrap : public ClapTrap {
|
||||
public:
|
||||
ScavTrap(std::string name);
|
||||
|
||||
void guardGate();
|
||||
protected:
|
||||
|
||||
private:
|
||||
bool _gateKeeperMode;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/10 15:50:07 by rparodi #+# #+# */
|
||||
/* Updated: 2025/01/24 17:37:56 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/01/24 18:51:51 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,6 +20,9 @@ int main(void) {
|
|||
test.attack("Moulinette");
|
||||
test.takeDamage(42);
|
||||
test.beRepaired(42);
|
||||
test.guardGate();
|
||||
test.guardGate();
|
||||
test.guardGate();
|
||||
std::cout << "\n\n[Broadcast]\n\tIn the Blue corner the actual cat of the 42 school !" << std::endl;
|
||||
ClapTrap test2("Moulinette");
|
||||
test2.beRepaired(32);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue