1struct CommonBase {
2 int m_base;
3 int virt_base_val;
4 int func_base_val;
5 virtual int virt_base() { return virt_base_val; }
6 virtual int virt_common() { return 555; }
7 int func_base() { return func_base_val; }
8 int func_common() { return 777; }
9};
10
11struct Base1 : CommonBase {
12 int m1 = 22;
13 Base1() {
14 // Give the base functions/members unique values.
15 virt_base_val = 111;
16 func_base_val = 112;
17 m_base = 11;
18 }
19 virtual int virt1() { return 3; }
20 int func1() { return 4; }
21};
22
23struct Base2 : CommonBase {
24 int m2 = 33;
25 Base2() {
26 // Give the base functions/members unique values.
27 virt_base_val = 121;
28 func_base_val = 122;
29 m_base = 12;
30 }
31 virtual int virt2() { return 5; }
32 int func2() { return 6; }
33};
34
35struct FinalClass : Base1, Base2 {
36 int m_final = 44;
37 virtual int final_virt() { return 7; }
38 int final_func() { return 8; }
39 virtual int virt_common() { return 444; }
40 int func_common() { return 888; }
41};
42
43int main() {
44 FinalClass C;
45 // Call functions so they get emitted.
46 C.func1();
47 C.func2();
48 C.final_func();
49 C.func_common();
50 C.Base1::func_base();
51 return 0; // break here
52}
53

source code of lldb/test/API/lang/cpp/multiple-inheritance/main.cpp