Bonjours à tous,
je viens de commencer le C++ depuis quelques jours et j'ai une classe qui plante à la compilation alors qu'elle est quasiment à une autre classe, je peux pas vous preciser l'erreur car il y a 17 messages d'erreurs.
Merci de me dire ce qui va pas avec ce code
Armure.cpp
Armure.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #include <iostream> #include <string> #include "Armure.h" using namespace std; Armure::Armure() : m_nom("aucune armure"), m_protection(0) { } Armure::Armure(string nom, int protection) : m_nom(nom), m_protection(protection) { } void Armure::changer(string nouvelleArmure, int newProtection) { m_nom = nouvelleArmure; m_protection = newProtection; } void Armure::afficher() { cout << "Armure : " << m_nom << "Protection : " << m_protection << endl; } int Armure::getProtection() const { return m_protection; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 DEFINE_ARMURE #define DEFINE_ARMURE class Armure { public: Armure(); Armure(std::string nom, int protection); void changer(std::string nouvelleArmure, int newProtection); void afficher(); int getProtection() const; private: std::string m_nom; int m_protection; } #endif
Partager