C
cppaddict
Hi,
When
cin >> myVar
is successful, the ">>" operator returns the cin object. But when it fails
it returns 0, or false. My question is: Since a function can only return
one type, how is this possible? Is the cin object being cast to a boolean?
If so, how does one define, in general, casting for custom classes? If not,
what is going on here?
Thanks,
cpp
When
cin >> myVar
is successful, the ">>" operator returns the cin object. But when it fails
it returns 0, or false. My question is: Since a function can only return
one type, how is this possible? Is the cin object being cast to a boolean?
If so, how does one define, in general, casting for custom classes? If not,
what is going on here?
Thanks,
cpp