I'm working on a class called coord that's just two dimensional coordinates. The only data members are the x-coordinate and the y-coordinate. I wrote a function to input a coord like so, but the compiler is giving me this error:
Code:
is >> char1 >> X >> char2 >> Y >> char3;
^
File "Hard Drive:Desktop Folder:Comp Prgms:My RPG:coord.cpp"; line 108
#Error: ambiguous type conversion
Had: ios::operator const void*() const
and: ios::operator void*()
I don't know what the problem is. I followed the same format to implement this function as my textbook used to implement a rational number class. Here's the implementation of my input function:
Code:
istream& operator >> (ostream &is, coord &c)
{
char char1, char2, char3;
int X = 0, Y = 0;
is >> char1 >> X >> char2 >> Y >> char3;
assert(char1 == '(');
assert(char2 == ',');
assert(char3 == ')');
coord pair(X,Y);
c = pair;
return is;
}
Any help will be much appreciated. This is my first class that I have written, and I think this is the last bug in it *crosses fingers*. Thanks in advance.