C++异常相关

参考:C++Primer p172,p684

何时用:程序可能无法处理某个问题,需要用到异常处理。

包括:

异常检测:throw引发(raise)了异常

异常处理:try语句块

try
{
    program-statements
}
catch(exception-declaration) //异常声明
{
    handler-statements //处理代码:例如提示语句
}
catch(exception-declaration)
{
    handler-statements
}
 
 

猜你喜欢

转载自blog.csdn.net/vict_wang/article/details/80996677
今日推荐