📄 lt04.cpp
字号:
int j;
double d;
char str[20];
class Coords
{
public:
Coords(double a,double b);
//...
};
class String
{
public;
String(char *);
//...
};
void f()
{
try
{
//...
throw 10;
//...
throw j; //j为int型
//...
throw d; //d为double型
throw "abc";
//...
throw str; //字符串
//...
throw Coords(1.0,3.0);
//...
throw String("def");
}
catch(int k)
{
//...
}
catch(double x)
{
//...
}
catch(char * ptr)
{
//...
}
catch(Coords c)
{
//...
}
catch(String s)
{
//...
}
cout<<"That is ok.\n";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -