设为首页 加入收藏

TOP

C++ 异常处理 terminate函数使用
2014-11-24 01:01:08 来源: 作者: 【 】 浏览:0
Tags:异常 处理 terminate 函数 使用

C++ 异常处理 terminate函数使用代码:


#include
using namespace std;


void terminator(){
cout << "I 'll be back!" < exit(0);
}


void (*old_terminate)() = set_terminate(terminator);



class B{
public :
class A{};
void f(){
cout<<"B::f()"< throw A();
}
~B(){
throw 'c';
}
};


int main(){
try{
B b;
b.f();
}catch(...){
cout<<"inside catch(...)"< }
return 0;
}



】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇C++学习之继承:点和圆 下一篇Android 2.1 架构解析

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: