-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathctorinits.cpp
More file actions
97 lines (78 loc) · 1.19 KB
/
ctorinits.cpp
File metadata and controls
97 lines (78 loc) · 1.19 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
int printf(const char*, ...);
struct NoisyInt
{
NoisyInt(int value = 0) : m_value(value) { printf("constructor %d\n", m_value); }
~NoisyInt() { printf("destructor %d\n", m_value); }
int m_value;
};
struct NoisyPair
{
NoisyPair(int fst, int snd)
: m_fst(fst)
, m_snd(snd) {}
NoisyPair() : NoisyPair(0, 0) {}
NoisyInt m_fst, m_snd;
};
struct NoisyTriple : NoisyPair
{
NoisyInt m_third;
};
class ArrayInt
{
ArrayInt() {}
~ArrayInt() {}
NoisyInt m_array[10];
};
int main()
{
NoisyTriple t;
}
class ArrayMemberInit
{
public:
ArrayMemberInit() : xs{0,1,2,3} {} // initializer
private:
int xs[4];
};
struct A {
A(int);
};
struct B {
B(int);
};
struct C {
C(int);
};
struct MultipleBases : A, B, C {
int x;
int y;
int z;
MultipleBases() :
z(5),
B(1),
x(3),
A(0),
C(2),
y(4) {
}
};
struct VB {
VB();
VB(int);
~VB();
};
struct VD : virtual VB {
};
struct VirtualAndNonVirtual : VD, VB {
VirtualAndNonVirtual() {
}
~VirtualAndNonVirtual() {
}
};
struct AllYourVirtualBaseAreBelongToUs : VD, VirtualAndNonVirtual, virtual VB {
AllYourVirtualBaseAreBelongToUs() :
VB(5) {
}
~AllYourVirtualBaseAreBelongToUs() {
}
};