Upload Tizen:Base source
[external/gdb.git] / gdb / testsuite / gdb.cp / derivation.cc
1 class A {
2 public:
3     int a;
4     int aa;
5
6     A()
7     {
8         a=1;
9         aa=2;
10     }
11     int afoo();
12     int foo();
13     
14 };
15
16
17
18 class B {
19 public:
20     int b;
21     int bb;
22
23     B()
24     {
25         b=3;
26         bb=4;
27     }
28     int bfoo();
29     int foo();
30     
31 };
32
33
34
35 class C {
36 public:
37     int c;
38     int cc;
39
40     C()
41     {
42         c=5;
43         cc=6;
44     }
45     int cfoo();
46     int foo();
47     
48 };
49
50
51
52 class D : private A, public B, protected C {
53 public:
54     int d;
55     int dd;
56
57     D()
58     {
59         d =7;
60         dd=8;
61     }
62     int dfoo();
63     int foo();
64     
65 };
66
67
68 class E : public A, B, protected C {
69 public:
70     int e;
71     int ee;
72
73     E()
74     {
75         e =9;
76         ee=10;
77     }
78     int efoo();
79     int foo();
80     
81 };
82
83
84 class F : A, public B, C {
85 public:
86     int f;
87     int ff;
88
89     F()
90     {
91         f =11;
92         ff=12;
93     }
94     int ffoo();
95     int foo();
96     
97 };
98
99 class G : private A, public B, protected C {
100 public:
101     int g;
102     int gg;
103     int a;
104     int b;
105     int c;
106
107     G()
108     {
109         g =13;
110         gg =14;
111         a=15;
112         b=16;
113         c=17;
114         
115     }
116     int gfoo();
117     int foo();
118     
119 };
120
121
122
123
124 int A::afoo() {
125     return 1;
126 }
127
128 int B::bfoo() {
129     return 2;
130 }
131
132 int C::cfoo() {
133     return 3;
134 }
135
136 int D::dfoo() {
137     return 4;
138 }
139
140 int E::efoo() {
141     return 5;
142 }
143
144 int F::ffoo() {
145     return 6;
146 }
147
148 int G::gfoo() {
149     return 77;
150 }
151
152 int A::foo()
153 {
154     return 7;
155     
156 }
157
158 int B::foo()
159 {
160     return 8;
161     
162 }
163
164 int C::foo()
165 {
166     return 9;
167     
168 }
169
170 int D::foo()
171 {
172     return 10;
173     
174 }
175
176 int E::foo()
177 {
178     return 11;
179     
180 }
181
182 int F::foo()
183 {
184     return 12;
185     
186 }
187
188 int G::foo()
189 {
190     return 13;
191     
192 }
193
194
195 void marker1()
196 {
197 }
198
199
200 int main(void)
201 {
202
203     A a_instance;
204     B b_instance;
205     C c_instance;
206     D d_instance;
207     E e_instance;
208     F f_instance;
209     G g_instance;
210     
211     #ifdef usestubs
212        set_debug_traps();
213        breakpoint();
214     #endif
215     
216
217     marker1(); // marker1-returns-here
218     
219     a_instance.a = 20; // marker1-returns-here
220     a_instance.aa = 21;
221     b_instance.b = 22;
222     b_instance.bb = 23;
223     c_instance.c = 24;
224     c_instance.cc = 25;
225     d_instance.d = 26;
226     d_instance.dd = 27;
227     e_instance.e = 28;
228     e_instance.ee =29;
229     f_instance.f =30;
230     f_instance.ff =31;
231     
232     
233     
234
235     return 0;
236     
237 }
238
239     
240