cpp01...
This commit is contained in:
23
ex03/HumanA/HumanA.cpp
Normal file
23
ex03/HumanA/HumanA.cpp
Normal 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
31
ex03/HumanA/HumanA.hpp
Normal 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
|
||||
Reference in New Issue
Block a user