-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.cc
77 lines (59 loc) · 933 Bytes
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include <stddef.h>
#include <string>
using namespace std;
class cs
{
public:
explicit cs(int i) :i_(i) { cout << "cs constructor:" << i << endl; }
~cs() { cout << "cs destructor:" << i_ << endl; }
private:
int i_;
};
void test_func3()
{
cs c(33);
cs c2(332);
throw 3;
cs c3(333);
cout << "test func3" << endl;
}
void test_func3_2()
{
cs c(32);
cs c2(322);
test_func3();
cs c3(323);
test_func3();
}
void test_func2() throw(int, string)
{
cs c(22);
cout << "test func2" << endl;
try
{
test_func3_2();
cs c2(222);
}
catch (int)
{
cout << "catch 2" << endl;
}
}
void test_func1()
{
cout << "test func1" << endl;
try
{
test_func2();
}
catch (...)
{
cout << "catch 1" << endl;
}
}
int main()
{
test_func1();
return 0;
}