Yes.. yes.. i know this topic has been covered many times..
I've looked through other posts but cannot find the solution i am looking for.. here is my problem:
cout << result;
someone want to tell me what i'm doin' wrong?
friend ostream &operator<<(ostream &out, Rational &c);
int numerator, denominator;
numerator = 0;
denominator = 1;
ostream &operator<<(ostream &out, Rational &c)
out << c.numerator << "/" << c.denominator;
shouldn't 0/1 be outputed to the screen?
i understand overloading operators but this is the first time i've ever tried to overload the '<<' operator.
compiler is giving me following errors:
friends must be functions or classes.
declaration missing ;
declaration does not specify a tag or identifier.
Declaration syntax error.
Undefined symbol cout.
This is not my entire code.. but i believe i've supplied enough info..
so any ideas what i am doing wrong?