ex01 done

This commit is contained in:
2025-09-19 12:37:04 +02:00
parent 52b6a47ffa
commit 7cce8266c4
6 changed files with 311 additions and 0 deletions

39
ex01/main.cpp Normal file
View File

@@ -0,0 +1,39 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/12 13:17:34 by aortigos #+# #+# */
/* Updated: 2025/09/19 12:34:26 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "ClapTrap/ClapTrap.hpp"
#include "ScavTrap/ScavTrap.hpp"
int main()
{
std::cout << "--- Testing ClapTrap ---" << std::endl;
ClapTrap a("Alice");
a.attack("enemy");
a.takeDamage(3);
a.beRepaired(2);
a.attack("enemy");
std::cout << "\n--- Testing ScavTrap ---" << std::endl;
ScavTrap b("Bob");
b.attack("enemy");
b.takeDamage(20);
b.beRepaired(10);
b.guardGate();
std::cout << "\n--- Copy and Assignment Test ---" << std::endl;
ScavTrap c = b; // copy constructor
ScavTrap d;
d = b; // assignment operator
d.attack("another enemy");
return 0;
}