Ask Question
24 November, 05:59

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

+1
Answers (1)
  1. 24 November, 06:17
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers