C++, catch user-defined exceptions in multiple blocks

前端 未结 1 1608
我寻月下人不归
我寻月下人不归 2021-01-27 09:20

Suppose the following example. There are classes A-C derived from std::exception:

#include 
#include 
#include 

c         


        
相关标签:
1条回答
  • 2021-01-27 09:50

    Only the first catch block that matches is going to execute. You can re-throw the existing exception with the "throw;" statement but I am not sure if that will continue the search at the next catch block or only in a outer try-catch.

    0 讨论(0)
提交回复
热议问题