CPP03 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
ClapTrap.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ClapTrap.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/05/08 12:47:08 by kamitsui #+# #+# */
9/* Updated: 2025/05/09 03:09:18 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#ifndef CLAPTRAP_HPP
21#define CLAPTRAP_HPP
22
23#include <iostream>
24#include <string>
25
34class ClapTrap {
35 private:
36 std::string name;
37 unsigned int hitPoints;
38 unsigned int energyPoints;
39 unsigned int attackDamage;
40
41 public:
45 ClapTrap();
46
50 ClapTrap(const std::string &name);
51
55 ClapTrap(const ClapTrap &other);
56
60 ~ClapTrap();
61
65 ClapTrap &operator=(const ClapTrap &other);
66
70 void attack(const std::string &target);
71
75 void takeDamage(unsigned int amount);
76
80 void beRepaired(unsigned int amount);
81
85 const std::string &getName() const;
86
90 unsigned int getHitPoints() const;
91
95 unsigned int getEnergyPoints() const;
96
100 unsigned int getAttackDamage() const;
101};
102
103#endif
Represents a basic robot character.
Definition ClapTrap.hpp:34
void beRepaired(unsigned int amount)
beRepaired function implementation.
Definition ClapTrap.cpp:108
unsigned int getHitPoints() const
Gets the current hit points of the ClapTrap.
Definition ClapTrap.cpp:132
unsigned int getAttackDamage() const
Gets the attack damage of the ClapTrap.
Definition ClapTrap.cpp:144
ClapTrap()
Default constructor implementation.
Definition ClapTrap.cpp:27
void takeDamage(unsigned int amount)
takeDamage function implementation.
Definition ClapTrap.cpp:89
void attack(const std::string &target)
Attack function implementation.
Definition ClapTrap.cpp:73
ClapTrap & operator=(const ClapTrap &other)
Copy assignment operator implementation.
Definition ClapTrap.cpp:58
~ClapTrap()
Destructor implementation.
Definition ClapTrap.cpp:51
const std::string & getName() const
Gets the name of the ClapTrap.
Definition ClapTrap.cpp:126
unsigned int getEnergyPoints() const
Gets the current energy points of the ClapTrap.
Definition ClapTrap.cpp:138