Which order is generally used in C++ exception handling?
Options
- A. catch, throw, try
- B. try, throw, catch
- C. throw, catch, try
- D. More than one of the above
- E. None of the above
Quiz Practice:
B. try, throw, catch
Answer: (B) try, throw, catch
The basic flow of C++ exception handling is:
1. try: The code that may generate an exception is placed inside the try block.
2. throw: When an exceptional condition occurs, an exception can be generated using throw.
3. catch: A suitable catch block receives and handles the thrown exception.
Therefore, the basic conceptual order is try → throw → catch.