CPP04 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Cure.cpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Cure.cpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/05/29 23:50:37 by kamitsui #+# #+# */
9/* Updated: 2025/06/02 05:47:06 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
22#include "Cure.hpp"
23#include "Logger.hpp"
24
29Cure::Cure() : AMateria("cure") { LOG_INFO("Cure constructor called"); }
30
36Cure::Cure(const Cure &other) : AMateria(other) { LOG_INFO("Cure copy constructor called"); }
37
45Cure &Cure::operator=(const Cure &other) {
46 LOG_INFO("Cure copy assignment operator called");
48 return *this;
49}
50
54Cure::~Cure() { LOG_INFO("Cure destructor called"); }
55
60AMateria *Cure::clone() const { return new Cure(); }
61
67void Cure::use(ICharacter &target) { std::cout << "* heals " << target.getName() << "'s wounds *" << std::endl; }
Declares the Cure materia class.
Defines the Logger class for console-based logging.
#define LOG_INFO(msg)
Macro for logging informational messages.
Definition Logger.hpp:70
Represents an abstract base class for all magical materias.
Definition AMateria.hpp:42
virtual AMateria & operator=(const AMateria &rhs)
Copy assignment operator for AMateria. Assigns the type from another AMateria object....
Definition AMateria.cpp:55
Represents a healing magic materia.
Definition Cure.hpp:36
Cure & operator=(const Cure &other)
Copy assignment operator for Cure. Assigns values from another Cure object by calling the base class ...
Definition Cure.cpp:45
virtual void use(ICharacter &target)
Uses the Cure materia to heal the target character. Prints a message indicating that the target's wou...
Definition Cure.cpp:67
virtual ~Cure()
Destroys the Cure object.
Definition Cure.cpp:54
Cure()
Default constructor for Cure. Initializes the materia type to "cure".
Definition Cure.cpp:29
virtual AMateria * clone() const
Creates a new, identical instance of a Cure materia.
Definition Cure.cpp:60
An interface for any character that can interact with Materias.
virtual std::string const & getName() const =0
Gets the name of the character. This is a pure virtual function, requiring derived classes to impleme...
T endl(T... args)