CPP04 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Ice.cpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Ice.cpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/05/29 23:48:31 by kamitsui #+# #+# */
9/* Updated: 2025/06/02 04:58:57 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
22#include "Ice.hpp" // Includes the declaration of the Ice class
23#include "Logger.hpp"
24
29Ice::Ice() : AMateria("ice") { LOG_INFO("Ice constructor called"); }
30
37Ice::Ice(const Ice &other) : AMateria(other) { LOG_INFO("Ice copy constructor called"); }
38
46Ice &Ice::operator=(const Ice &other) {
47 LOG_INFO("Ice copy assignment operator called");
49 return *this;
50}
51
56Ice::~Ice() { LOG_INFO("Ice destructor called"); }
57
63AMateria *Ice::clone() const { return new Ice(); }
64
71void Ice::use(ICharacter &target) { std::cout << "* shoots an ice bolt at " << target.getName() << " *" << std::endl; }
Declares the Ice 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
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...
Represents an ice-based offensive magic materia.
Definition Ice.hpp:36
virtual AMateria * clone() const
Creates a new, identical instance of an Ice materia. This method overrides the clone() pure virtual f...
Definition Ice.cpp:63
Ice()
Default constructor for Ice. Initializes the materia type to "ice" and displays a construction messag...
Definition Ice.cpp:29
Ice & operator=(const Ice &other)
Copy assignment operator for Ice. Assigns values from another Ice object by calling the base class as...
Definition Ice.cpp:46
virtual ~Ice()
Destroys the Ice object. Displays a destruction message.
Definition Ice.cpp:56
virtual void use(ICharacter &target)
Uses the Ice materia to shoot an ice bolt at the target character. This method overrides the use() vi...
Definition Ice.cpp:71
T endl(T... args)