Constructor failed: design question
I am wondering what the best way to tell the user a constructor failed is. What I currently do is have my constructors do very little or nothing, and define an Init() method. This Init() method returns values so it can be checked whether it worked or not, and does everything I'd LIKE to do in my constructor.
I could also have a bit set to PASS/FAIL or something, and the caller should always check this bit after instantiating an object of one of my classes.
However neither of these methods seems particularly nice for the calling function, since they could forget to check a bit, or never call Init() before some other method (I can handle this easily internally to my class, however).
I am wondering what others recommend?? Is there a nice way to tell the calling function "construction failed"?
Just curious. Thank!