there is the code :
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
class Flacon
{
private:
string nom;
double volume;
double pH;
public:
Flacon(string nom, double volume, double pH): nom(nom), volume(volume), pH(pH) {}
ostream& etiquette(ostream&) const;
friend ostream& operator<<(ostream&,const Flacon &);
Flacon& operator+(Flacon const&);
};
Flacon& Flacon::operator+(Flacon const& f){
this->nom=this->nom + f.nom;
this->volume+= f.volume;
this->pH=-log((this->volume * pow(10,-this->pH) + f.volume * pow(10,-f.pH))/(this->volume + f.volume));
return *this;
ostream& Flacon::etiquette(ostream& sortie) const {
sortie << nom << " : " << volume << " ml, pH " << pH;
return sortie;}
I have the error :
error: qualified-id in declaration before ‘(’ token
At line 27 :
ostream& Flacon::etiquette(ostream& sortie) const {
Thank you for your help
I would also like to know why this.name displays an error when this->name does not display one