This commit is contained in:
Angel Ortigosa Perez
2025-09-07 10:03:17 +02:00
commit 859690063b
30 changed files with 846 additions and 0 deletions

23
ex03/HumanA/HumanA.cpp Normal file
View File

@@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* HumanA.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "HumanA.hpp"
HumanA::HumanA(const std::string &name, Weapon &weapon)
: name(name), weapon(weapon) {}
void HumanA::attack() const
{
std::cout << this->name << " attacks with their "
<< this->weapon.getType()
<< std::endl;
}

31
ex03/HumanA/HumanA.hpp Normal file
View File

@@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* HumanA.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef HUMANA_HPP
# define HUMANA_HPP
# include <iostream>
# include "../Weapon/Weapon.hpp"
class HumanA
{
private:
std::string name;
Weapon &weapon;
public:
HumanA(const std::string &name, Weapon &weapon);
void attack() const;
};
#endif