64,662
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
using namespace std;
int main()
{
void f1();
try
{f1();}
catch(double)
{cout<<"error1"<<endl;}
cout<<"endmain"<<endl;
return 0;
}
void f1()
{
void f2();
try
{
f2();
}
catch(int)
{
cout<<"error2"<<endl;
}
cout<<"endf1"<<endl;
}
void f2()
{
void f3();
try
{
f3();
}
catch(char)
{
cout<<"error3"<<endl;
}
cout<<"endf2"<<endl;
}
void f3()
{
double a=0,b=1.2;
class SS
{
public:
SS()
{
cout<<"now construct"<<endl;
}
~SS()
{
cout<<"now destruct"<<endl;
}
private:
int aa;
};
SS s;
throw a;
try
{
a=0;
}
catch(float)
{ cout<<"error3"<<endl;
}
cout<<"endf2"<<endl;
}