blob: 9ca8e935df9d9496829c936bb405845baccc7476 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- main.cpp ------------------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10class A
11{
12public:
13 A(int i=0):
14 m_a_int(i),
15 m_aa_int(i+1)
16 {
17 }
18
19 //virtual
20 ~A()
21 {
22 }
23
24 int
25 GetInteger() const
26 {
27 return m_a_int;
28 }
29 void
30 SetInteger(int i)
31 {
32 m_a_int = i;
33 }
34
35protected:
36 int m_a_int;
37 int m_aa_int;
38};
39
40class B : public A
41{
42public:
43 B(int ai, int bi) :
44 A(ai),
45 m_b_int(bi)
46 {
47 }
48
49 //virtual
50 ~B()
51 {
52 }
53
54 int
55 GetIntegerB() const
56 {
57 return m_b_int;
58 }
59 void
60 SetIntegerB(int i)
61 {
62 m_b_int = i;
63 }
64
65protected:
66 int m_b_int;
67};
68
69
70class C : public B
71{
72public:
73 C(int ai, int bi, int ci) :
74 B(ai, bi),
75 m_c_int(ci)
76 {
77 }
78
79 //virtual
80 ~C()
81 {
82 }
83
84 int
85 GetIntegerC() const
86 {
87 return m_c_int;
88 }
89 void
90 SetIntegerC(int i)
91 {
92 m_c_int = i;
93 }
94
95protected:
96 int m_c_int;
97};
98
99int
100main (int argc, char const *argv[])
101{
102 A a(12);
103 B b(22,33);
104 C c(44,55,66);
105 return b.GetIntegerB() - a.GetInteger() + c.GetInteger();
106}