hey I am trying to run a program and I get this error:
Exception thrown at 0x004066A0 in INF1010 TP1.exe: 0xC0000005: Access violation reading location 0x0000A0EC. Unhandled exception thrown: read access violation. this was 0xA0CC.
here is my .cpp code I am not sure what is wrong with it
//Constructeurs
Depense::Depense() {
titre_ = "";
montant_ = 0.0;
}
Depense::Depense(const string& titre, double montant) {
titre_ = "titre";
montant_ = montant;
}
string Depense::getTitre() const {
return titre_;
}
double Depense::getMontant() {
return montant_; //error is here
}
void Depense::setTitre(string& titre) {
titre_ = titre;
}
void Depense::setMontant(double montant) {
montant_ = montant;
}
sorry if its in french... all of the necessary #include are also in my file
this is the header file that is associated:
class Depense {
public :
// constructeurs par défaut et parametres
Depense();
Depense(const string& titre, double montant );
// methodes d'accès
string getTitre() const;
double getMontant();
//methodes de modifications
void setTitre(string& titre);
void setMontant(double montant);
//methode d'affichage
void afficherDepense();
private :
string titre_;
double montant_;
};
Thanks a lot in advance :)
User contributions licensed under CC BY-SA 3.0