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/11 05:30:33 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
26#ifndef CLAPTRAP_HPP
27#define CLAPTRAP_HPP
28
29#include <iostream>
30#include <string>
31
40class ClapTrap {
41 protected:
42 std::string name;
43 unsigned int hitPoints;
44 unsigned int energyPoints;
45 unsigned int attackDamage;
46
47 public:
49 ClapTrap(const std::string &name);
50 ClapTrap(const ClapTrap &other);
51
55 virtual ~ClapTrap();
56
57 ClapTrap &operator=(const ClapTrap &other);
58
62 virtual void attack(const std::string &target);
63
64 void takeDamage(unsigned int amount);
65 void beRepaired(unsigned int amount);
66
70 const std::string &getName() const;
71
75 unsigned int getHitPoints() const;
76
80 unsigned int getEnergyPoints() const;
81
85 unsigned int getAttackDamage() const;
86};
87
88#endif
Represents a basic robot character.
Definition ClapTrap.hpp:34
virtual ~ClapTrap()
Destructor implementation.
void beRepaired(unsigned int amount)
unsigned int getHitPoints() const
Gets the current hit points of the ClapTrap.
unsigned int getAttackDamage() const
Gets the attack damage of the ClapTrap.
virtual void attack(const std::string &target)
Attack function implementation.
ClapTrap(const ClapTrap &other)
void takeDamage(unsigned int amount)
ClapTrap & operator=(const ClapTrap &other)
const std::string & getName() const
Gets the name of the ClapTrap.
unsigned int getEnergyPoints() const
Gets the current energy points of the ClapTrap.
ClapTrap(const std::string &name)