ex01 done
This commit is contained in:
39
ex01/main.cpp
Normal file
39
ex01/main.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user