C++ Constructors Question:
Download Job Interview Questions and Answers PDF
Tell me how should a constructor handle a failure?
Answer:
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.
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.
Download C++ Constructors Interview Questions And Answers
PDF
Previous Question | Next Question |
Can you please explain Explain constructors and destructors? | Do you know what are destructors? |