A inclus B qui inclus A, dépendance circulaire
Bonjour,
je suis un debutant en c++ et je suis entraine de faire un code pour m'entraîner. Il y a une erreur que je n'arrive pas à comprendre :
Il disent qu'a la ligne 17, il y a une faute. Mais, jai faite copier/coller de mon autre code.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #ifndef MONSTRE_H
#define MONSTRE_H
#include "raider.h"
class Monstre
{
private:
std::string nom;
int hp;
int level;
int force;
int rapidite;
int defense;
bool estVivant;
public:
void attaquer(Raider &ennemi);
int getDefense() const;
void seFaireAttaquer(int x);
int getHp() const;
int getLevel() const;
};
#endif |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| #ifndef RAIDER_H
#define RAIDER_H
#include "Monstre.h"
class Raider
{
private:
std::string nom;
int hp;
int sp;
int xp;
int level;
double argent;
std::string classe;
int force;
int rapidite;
int defense;
std::string armure;
std::string Arme;
bool estVivant;
int cadence;
bool quelArme;
int boost;
public:
Raider();
void seSoigner();
void seRecuperer();
void attaquer(Monstre &cible);
void changerLevel();
void attaqueSpecial(Monstre &cible);
void changerArme();
int getForce() const;
void perdreSp(int x);
};
#endif |