Ciao a tutti!
Sto creando una classe Esame ma in compilazione mi dà errori. Posto i codici.
esame.h
esame.cppcodice:#ifndef esame_h #define esame_h #include <string.h> class esame { public: esame(); esame(string); esame(string,int); string getEsame(); void setEsame(); int getvoto(); void setvoto(int); bool isSostenuto(); private: string nomeEsame; bool sostenuto; int votoEsame; }; #endif
L'errore che mi dà è il seguente:codice:#include "esame.h" #include <stdlib.h> #include <iostream> #include <string.h> using namespace std; esame::esame() { nomeEsame=""; sostenuto=false; votoEsame=0; } esame::esame (string esame) { nomeEsame=esame; } esame::esame(string esame, int voto){ nomeEsame=esame; votoEsame=voto; sostenuto=true; } string esame::getEsame(){ return nomeEsame; } void esame::setEsame(string esame){ nomeEsame=esame; } int esame::getvoto(){ return votoEsame; } void esame::setvoto(int voto){ votoEsame=voto; sostenuto=true; } bool esame::isSostenuto(){ return sostenuto; }
riga 9 C:\Dev-Cpp\esame.h field `string' has incomplete type
Domanda:dove ho sbagliato?![]()

Rispondi quotando