TurkeyMaster77
12-16-2008, 08:45 AM
I'm simply having compiler error as I attempt to overload '<<.' The following code throws this error:
"error C2804: binary 'operator <<' has too many parameters MyObject.cpp"
Header file:
ostream& operator<< (ostream&, const MyObject&);
.cpp file:
ostream& operator<< (ostream& stream, const MyObject& obj)
{
stream << obj.code;
return stream;
}
Every search result I find has instructed me to follow almost this format exactly. I can't figure out what I'm doing wrong!
"error C2804: binary 'operator <<' has too many parameters MyObject.cpp"
Header file:
ostream& operator<< (ostream&, const MyObject&);
.cpp file:
ostream& operator<< (ostream& stream, const MyObject& obj)
{
stream << obj.code;
return stream;
}
Every search result I find has instructed me to follow almost this format exactly. I can't figure out what I'm doing wrong!