C++ friend operator+ overloading -


i'm confused friend operator overloading. has no problem if write friend operator overloading function within header file, gives me following errors once moved function class file. googled samples , written function in header file. did wrong? thanks.

...: error: expected ‘,’ or ‘...’ before ‘&’ token ...: error: iso c++ forbids declaration of ‘statisticain’ no type ...: error: ‘main_savitch_2c::statistician operator+(int)’ must have argument of class or enumerated type   // a.h class {     public:         friend operator + (const &a1, const &a2); };  // a.cpp #include "a.h" operator + (const &a1, const &a2) {     // } 

from error message you're getting:

iso c++ forbids declaration of ‘statisticain’ no type 

i think misspelled "statistician" reversing last 2 letters (note have "statisticain" instead of "statistician.")

this should have nothing whether operator+ implemented in header or .cpp file.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -