I'm curious how the fstream
class
is able to return a true
or false
value by simply placing the name of the object inside a conditional statement. For example...
std::fstream fileStream;
fileStream.open("somefile.ext");
if (!fileStream) // How does this work?
std::cout << "File could not be opened...\n";
I ask this because I want my own class to return a value if I use it in a similar way.