I don't really understand the underlying purpose of throwing an exception. I know that the programmer can allow for correction of the error without throwing the exception, and they could cause the program to abort without an exception as well, so why exactly throw an exception. Instead of using the try and catch, why not just try and write code that corrects the error or allows the user to correct the error. I know it's necessary and has a useful purpose, but so far I just can't grasp what that is. Any examples of exceptions that are necessary?



LinkBack URL
About LinkBacks



, is to remember that C++ allows for modularization of your code. A class may know about an error, but not know what to do with it, while the user of that class may know what to do, but not how to detect the error. And speaking of classes, we can say a namespace or an entire library.
CornedBee