首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

满载"<<" ostream不明确 VS2010

2014-01-19 
重载 ostream不明确 VS2010code :#includeiostreamusing namespace stdclass Point{public:Point(i

重载"<<" 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无法重载按返回类型区分的函数。 
[解决办法]
分号忘了加了

热点排行