Can a constructor return a NULL value?

Posted by Sanctus2099 on Stack Overflow See other posts from Stack Overflow or by Sanctus2099
Published on 2010-05-18T16:16:41Z Indexed on 2010/05/18 16:20 UTC
Read the original article Hit count: 246

Filed under:
|
|
|

I know constructors don't "return" anything but for instance if I call CMyClass *object = new CMyClass() is there any way to make object to be NULL if the constructor fails? In my case I have some images that have to be loaded and if the file reading fails I'd like it to return null. Is there any way to do that?
Thanks in advance.

© Stack Overflow or respective owner

Related posts about constructor

Related posts about c++