-
error msg
I am getting the following error msg:
Code:
Type mismatch in redeclaration of 'operator <<(ostream &,const String &)'
This is the code that relates to it :
Code:
//this is in the struct
friend ostream& operator <<( ostream& out, const String& wrd);
//this is the fnct
ostream& operator <<( ostream& out, const String& wrd)
{
out << wrd.str;
return out;
}
Thanx
-
Ok, yes I edited my entire message, that's because I'm a moron. The reason your getting the message is because ( at least it seems) that you are passing either a struct or class as a argument yet you overloaded the operator telling it you are passing a String reference. Here is the solution:
Code:
friend ostream& operator<<(ostream&, class& );
just replace class with whatever name you gave your class or struct.