top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can I handle a constructor that fails?

+1 vote
408 views
How can I handle a constructor that fails?
posted Dec 10, 2014 by Anwar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Follow this method to handle a constructor that fails:

Throw an exception. Constructors don't have a return type, so it's not possible to use return codes. The best way to signal constructor failure is therefore to throw an exception.

answer Dec 13, 2014 by Mohammed Hussain
...