Overloading >> Error C++ [closed]
开发者_运维技巧
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this questionWhenever I try to compile my program, I get a strange error. I have tried to look it up, and trying different methods of overloading it, but I still get errors.
istream& operator >> ( istream& in, MysteryCard& theMysteryCard )
{
int value;
in >> value;
theMysteryCard.change(value);
return in;
}
All of my variables are right, and the functions work, but I do not know why it isn't working.
13 no match for
'operator>>'
in'in >> value'
The change function is public as well.
It appears to me that you're missing an include. Make sure you have #include <istream>
and that you have either a using declaration for std::istream
or a using directive for namespace std
.
精彩评论