Well ... first please see this example using C++ ifstream:
My question is how does ifstream object behave like a bool value in above code?
using namespace std;
int main(int argc, char** argv)
if (argc != 2)
cout << "Please give a file name." << endl;
cout << "Success!" << endl;
cout << "Failure!" << endl;
I want to write my own class. And I wish it's objects would behave in the same way.
Can you please tell me how can I write such a class?