Ask Question
27 March, 21:22

11.19 (Constructor Failure) Write a program that shows a constructor passing information about constructor failure to an exception handler. Define class SomeClass, which throws an Exception in the constructor. Your program should try to create an object of type SomeClass and catch the exception that's thrown from the constructor

+2
Answers (1)
  1. 27 March, 23:58
    0
    You absolutely should throw an exception from a constructor if you're unable to create a valid object. This allows you to provide proper invariants in your class ... Throw an exception if you're unable to initialize the object in the constructor, one example are illegal arguments.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “11.19 (Constructor Failure) Write a program that shows a constructor passing information about constructor failure to an exception handler. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers