菜鸟问题,求好心人解答。
#ifndef POINT_H
#define POINT_H
#include<iostream>
class Point{
public :
Point(int ,int );
Point(Point &);
~Point();
int get_x();
int get_y();
void put_x(int x);
void put_y(int y);
Point operator+(Point p);
Point operator*(int i);
Point operator>(Point p);
Point operator<(Point p);
int operator==(Point &p);
private :
int x;
int y;
friend istream& operator >> (istream & in , Point &p);
friend ostream& operator << (istream & out , Point &p);
}
#endif
类定义如上
使用vs2010进行编译
编译失败
log如下:
错误 1 error C2143: 语法错误 : 缺少“;”(在“&”的前面) x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 2 error C2433: “istream”: 不允许在数据声明中使用“friend” x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 3 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 4 error C2061: 语法错误: 标识符“istream” x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 5 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 6 error C2805: 二进制“operator >>”的参数太少 x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 7 error C2143: 语法错误 : 缺少“;”(在“&”的前面) x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 8 error C2433: “ostream”: 不允许在数据声明中使用“friend” x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 9 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 10 error C2061: 语法错误: 标识符“istream” x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 11 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 12 error C2805: 二进制“operator <<”的参数太少 x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 13 error C1004: 发现意外的文件尾 x:\code\vs\data struct\类定义\类定义\类定义.cpp 27
14 IntelliSense: 未定义标识符 "istream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
15 IntelliSense: 未定义标识符 "istream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
16 IntelliSense: 未定义标识符 "ostream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
17 IntelliSense: 未定义标识符 "istream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 23