输入输出运算符重载 不明错误 大家帮我下
#include<iostream.h>class three_d
{
public :
int x,y,z;
three_d(int a, int b,int c)
{
x=a;
y=b;
z=c;
}
friend istream &operator>>(istream &input,three_d &ob);
friend ostream &operator<<(ostream &output,three_d &ob);
};
ostream &operator >>(ostream &output,three_d &ob)
{
output<<ob.x<<"######"<<ob.y<<"######"<<ob.z<<"######";
return output;
}
istream &operator<<(istream &input,three_d &ob)
{
cout<<"Enter x y z value :\n";
input>>ob.x>>ob.y>>ob.z;
return input;
}
void main()
{
three_d obj(10,20,30);
cout<<obj;
cin>>obj;
cout<<obj;
}
--------------------Configuration: 1111111111111 - Win32 Debug--------------------
Compiling...
main.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "class istream & __cdecl operator>>(class istream &,class three_d &)" (??5@YAAAVistream@@AAV0@AAVthree_d@@@Z)
main.obj : error LNK2001: unresolved external symbol "class ostream & __cdecl operator<<(class ostream &,class three_d &)" (??6@YAAAVostream@@AAV0@AAVthree_d@@@Z)
Debug/1111111111111.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
1111111111111.exe - 3 error(s), 0 warning(s)