d03 code refonte ex00 01 et 02

This commit is contained in:
Hugo LAMY
2022-02-22 19:05:24 +01:00
parent 088a54d036
commit 8c9d50dd68
12 changed files with 349 additions and 330 deletions

View File

@@ -4,14 +4,13 @@
#include <iostream>
#include <sstream>
#include <string>
#include <color.h>
class ClapTrap {
public:
ClapTrap( std::string name ); // default/parametric constructor
ClapTrap( ClapTrap const & src ); // copy constructor
ClapTrap( std::string name = ClapTrap::_dName );
ClapTrap( ClapTrap const & src ); // copy constructor
~ClapTrap( void ); // destructor
ClapTrap & operator=( ClapTrap const & rhs ); // assignement operator
@@ -21,18 +20,36 @@ public:
void beRepaired(unsigned int amount);
std::string getName() const;
std::string getClass() const;
int getHit() const;
int getEnergy() const;
int getAttack() const;
int getNumber() const;
protected:
int getTotalNumber() const;
std::string _name;
std::string _class;
int _hit;
int _energy;
int _attack;
int _number;
void _increaseNumber();
private:
ClapTrap( void ); // default/parametric constructor
void assignValues(ClapTrap & src);
static int _totalNumber;
std::string const _name;
int _hit;
int _energy;
int _attack;
static const std::string _dName;
static const std::string _dClass;
static const int _dHit;
static const int _dEnergy;
static const int _dAttack;
static const int _dNumber;
};