k, this board is my only available "lab" for a univeristy level course, so please help if u can...
i am pretty sure i simply do not understand classes yet, but my stupid assignment is asking me to overload operators and i just cant make the compiler happy. after following the instrcutor's example, i get stuck with odd compiler errors that dont make any sense (go figure).
if anyone can point out what i am doing wrong, i would appreciate it...
Code:#include <iostream.h> class point { private: float x; public: point() { cout<<"Enter a fraction: "; cin>>x; }; point operator +(point a, point b); // point a, point b }; float point operator +(point a, point b) { point result; result.x=a.x+b.x; return result; } void main() { point a; point b; a.read(); b.read(); point r1=a+b; }Code:fractions_source.cpp(9) : error C2804: binary 'operator +' has too many parameters fractions_source.cpp(11) : error C2143: syntax error : missing ';' before '+' fractions_source.cpp(11) : fatal error C1004: unexpected end of file found