读书人

满载quot;lt;lt;quot; ostream不明确 VS2010

发布时间: 2014-01-19 01:28:51 作者: rapoo

重载"<<" ostream不明确 VS2010
code :

#include<iostream>
using namespace std;


class Point
{
public:
Point(int x, int y):a(x),b(y){}
friend ostream &operator<<(std::ostream &stream,Point &Pone);
private:
int a;
int b;
}

ostream &operator <<(ostream &stream,Point &Pone)
{
stream << Pone.a << "," << Pone.b << endl;
return stream;
}
ostream 不明确 operator无法重载按返回类型区分的函数。
[解决办法]
分号忘了加了

读书人网 >C++

热点推荐