开发者

Overloading >> Error C++ [closed]

开发者 https://www.devze.com 2023-04-02 18:33 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. 开发者_运维技巧Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.
开发者_运维技巧

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

Whenever 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消