S
Steve
Hi Folks,
Sorry for this stupid question, but how do you handle errors during class
construction. In other words, if I have a class that loads a file, and
during loading, an error occurs, how do you deal with this in respect of
releasing the resources that would have been allocated if the load was
successful?
What I am trying to achieve is, if I call my class with new, how do I return
NULL if the construction fails (so I can check for fails). Also, if I call
the class without new, ie 'myclassname myclass(param)', how would you deal
with this in event of failure.
I hope my question is clear, I know what I want to ask, but not sure if I've
asked it properly.
Also, are answers to questions like this in Stroustrup's book?
Thanks for your time,
Steve.
Sorry for this stupid question, but how do you handle errors during class
construction. In other words, if I have a class that loads a file, and
during loading, an error occurs, how do you deal with this in respect of
releasing the resources that would have been allocated if the load was
successful?
What I am trying to achieve is, if I call my class with new, how do I return
NULL if the construction fails (so I can check for fails). Also, if I call
the class without new, ie 'myclassname myclass(param)', how would you deal
with this in event of failure.
I hope my question is clear, I know what I want to ask, but not sure if I've
asked it properly.
Also, are answers to questions like this in Stroustrup's book?
Thanks for your time,
Steve.