Ok guys. I have a class String, and i need to put the operator >> in that class. so i do this:
istream & operator>>(istream &in,String &str)
{
char string[30];
in.getline(string,30,'\n');
str=string;
return in;
}
but when i do:
void main()
{
String x;
cin>>x;
}
i have this error
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'String' (or there is no acceptable conversion)
why?? I have the operator << and it works with no problems. Any idea??



LinkBack URL
About LinkBacks



