I am getting the following error:
main.cpp:18:49: error: ‘intervall operator+(inv*, inv*)’ must have an argument of class or enumerated type inline struct intervall operator+(inv* a, inv* b){
It happens when I attempt to execute the following code:
typedef struct intervall inv; //Intervallstruct struct intervall { double sup; double inf; } x; //Addition inline struct intervall operator+(inv* a, inv* b){ inv c; c.inf=a->inf+b->inf; c.sup=a->sup+b->sup; return c; } //Input istream& operator>>(istream& is, struct intervall* x){ is >> x->inf >> x->sup; return is; }
I do not understand why I cannot use the argument inv*
to overload operator+
like this, since the other function works just fine.