cin is defines as: extern istream cin;
which means cin is an object, but while( ? ), here the type of the ? should be bool, right? So how does an object be transformed into a bool?
I defined one class by myself to test whether other objects could work properly, and the result shows they cannot. See the following example:
class Hello
{
public :
Hello(int var) : a(var) {}
private:
int a;
};
Hello h(0);
while ( h ); //error: could not convert "obj" to "bool"
So could anybody help explain how does while( cin ) work properly?
Thx in advance!