📄 13.9.cpp
字号:
#include <iostream.h>
#include <string.h>
void fun1(),fun2(),fun3();
class Except
{
public:
Except()
{ }
char *returnExpt()
{
return "Except";
}
};
class M
{
public:
M(char *s)
{
strcpy(mag,s);
cout<<"Constructor."<<mag<<endl;
}
~M()
{ cout<<"Destructor."<<mag<<endl; }
private:
char mag[80];
};
void main()
{
try
{
fun1();
}
catch(Except &e)
{
cout<<"The exception is caught."<<e.returnExpt()<<endl;
}
}
void fun1()
{
M m("fun1()");
fun2();
}
void fun2()
{
M m("fun2()");
fun3();
}
void fun3()
{
Except e;
M m("fun3()");
throw e;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -