CPP01 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Weapon.cpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Weapon.cpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/04/15 19:41:23 by kamitsui #+# #+# */
9/* Updated: 2025/04/23 01:23:19 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
18#include "Weapon.hpp"
19#include <iostream>
20
28Weapon::Weapon(std::string type) : type(type) { std::cout << "Weapon '" << this->type << "' created." << std::endl; }
29
33Weapon::~Weapon() { std::cout << "Weapon '" << this->type << "' destroyed." << std::endl; }
34
40const std::string &Weapon::getType() const { return this->type; }
41
47void Weapon::setType(const std::string &newType) { this->type = newType; }
Declares the Weapon class.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
ostream cout
const std::string & getType() const
Gets the type of the weapon.
Definition Weapon.cpp:40
~Weapon()
Destructor for the Weapon class.
Definition Weapon.cpp:33
void setType(const std::string &newType)
Sets the type of the weapon.
Definition Weapon.cpp:47
Weapon(std::string type)
Constructor for the Weapon class.
Definition Weapon.cpp:28