I have a class called mouse. I'm tring to use the << friend. In my public section of the class declaration I have:
In the cpp for the definitions I have:Code:friend ostream & operator << (ostream & o, const mouse m);
Then I get the error: binary '<<' : no operator defined which takes a right-hand operand of type 'class mouse' (or there is no acceptable conversion)Code:ostream & operator << (ostream & o, const mouse m) { // PRINT MOUSE o << "M"; return o; }
I'm not sure if you put friend in from of the word ostream but when I tried I got 3 errors, including the first:
'<<' : a friend function can only be declared in a class
'<<' : 'void' function returning a value
Anyone know whats going wrong? If you want I'll post the code, don't think its really nessicary seeing as I'm probably just missing something.
NOMAD




Reply With Quote