NEWBIE: Please advise on returning status of constructor
Posted on 2007-04-06
Given that constructors can't return anything, what is the preferred method of findiing out about their success?
As an example, I have a class that encapsulates a specific text file. I try to load the text file in the constructor. If the text file is not found, the class is worthless. Ideally, my constructor would return a boolean, indicating it couldn't find the file.
Given that I can't do that, what's the next best thing? I know I could set a class boolean, and then query that, but that seems awkward...