Chapter 16: Problem 24
Until this chapter, we have found that dealing with errors detected by constructors can be awkward. Exception handling gives us a better means of handling such errors. Consider a constructor for a string class. The constructor uses new to obtain space from the free store. Suppose new fails. Show how you would deal with this without exception handing. Discuss the key issues. Show how you would deal with such memory exhaustion with exception handling. Explain why the exception-handling approach is superior.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.