May 2012
Intermediate to advanced
679 pages
16h 56m
English
Exceptions are of two types: synchronous and non-synchronous. Events like power failure are considered non-synchronous. As a programmer, we have no control over them. Other exceptions are synchronous. They get generated while running our program. They are generated because of our program. A typical example is dividing by zero. In this section, we are basically discussing synchronous exceptions.
Now C++ offers an elegant way to handle these exceptions. It makes our program more robust. It is now possible that programs do not fail on trivial errors. In other words, they become fault tolerant to some extent.
The exception handling revolves around three statements, try, catch and throw.
Read now
Unlock full access