104494
|
1 /* Special test file for Semantic Analyzer and complex C++ inheritance.
|
|
2 *
|
|
3 * Header file for testsubclass.cpp with class defns but no
|
|
4 * implementations.
|
|
5 */
|
|
6
|
|
7 //#include <cmath>
|
|
8 // #include <stdio.h>
|
|
9
|
|
10 #ifndef TESTSUBCLASS_HH
|
|
11 #define TESTSUBCLASS_HH
|
|
12
|
|
13 namespace animal {
|
|
14
|
|
15 class moose {
|
|
16 public:
|
|
17 moose() : fFeet(0),
|
|
18 fIsValid(false)
|
|
19 { }
|
|
20
|
|
21 virtual void setFeet(int);
|
|
22 int getFeet();
|
|
23
|
|
24 void doNothing();
|
|
25
|
|
26 enum moose_enum {
|
|
27 NAME1, NAME2, NAME3 };
|
|
28
|
|
29
|
|
30 protected:
|
|
31
|
|
32 bool fIsValid;
|
|
33 int fIsProtectedInt;
|
|
34
|
|
35 private:
|
|
36 int fFeet; // Usually 2 or 4.
|
|
37 bool fIsPrivateBool;
|
|
38
|
|
39 }; // moose
|
|
40
|
|
41 int two_prototypes();
|
|
42 int two_prototypes();
|
|
43
|
|
44 class quadruped {
|
|
45 public:
|
|
46 quadruped(int a) : fQuadPrivate(a)
|
|
47 { }
|
|
48
|
|
49 int fQuadPublic;
|
|
50
|
|
51 protected:
|
|
52 int fQuadProtected;
|
|
53
|
|
54 private:
|
|
55 int fQuadPrivate;
|
|
56
|
|
57 };
|
|
58
|
|
59 }
|
|
60
|
|
61
|
|
62 namespace deer {
|
|
63
|
|
64 class moose : public animal::moose {
|
|
65 public:
|
|
66 moose() : fAntlers(false)
|
|
67 { }
|
|
68
|
|
69 void setAntlers(bool);
|
|
70 bool getAntlers();
|
|
71
|
|
72 void doSomething();
|
|
73
|
|
74 protected:
|
|
75
|
|
76 bool fSomeField;
|
|
77
|
|
78 private:
|
|
79 bool fAntlers;
|
|
80
|
|
81 };
|
|
82
|
|
83 } // deer
|
|
84
|
|
85 // A second namespace of the same name will test the
|
|
86 // namespace merging needed to resolve deer::alces
|
|
87 namespace deer {
|
|
88
|
|
89 class alces : public animal::moose {
|
|
90 public:
|
|
91 alces(int lat) : fLatin(lat)
|
|
92 { }
|
|
93
|
|
94 void setLatin(bool);
|
|
95 bool getLatin();
|
|
96
|
|
97 void doLatinStuff(moose moosein); // for completion testing
|
|
98
|
|
99 moose createMoose(); // for completion testing.
|
|
100
|
|
101 protected:
|
|
102 bool fAlcesBool;
|
|
103 int fAlcesInt;
|
|
104
|
|
105 private:
|
|
106 bool fLatin;
|
|
107 int fGreek;
|
|
108 };
|
|
109
|
|
110 };
|
|
111
|
|
112 // A third namespace with classes that does protected and private inheritance.
|
|
113 namespace sneaky {
|
|
114
|
|
115 class antelope : public animal::quadruped {
|
|
116
|
|
117 public:
|
|
118 antelope(int a) : animal::quadruped(),
|
|
119 fAntyProtected(a)
|
|
120 {}
|
|
121
|
|
122 int fAntyPublic;
|
|
123
|
|
124 bool testAccess();
|
|
125
|
|
126 protected:
|
|
127 int fAntyProtected;
|
|
128
|
|
129 private :
|
|
130 int fAntyPrivate;
|
|
131
|
|
132 };
|
|
133
|
|
134 class jackalope : protected animal::quadruped {
|
|
135
|
|
136 public:
|
|
137 jackalope(int a) : animal::quadruped(),
|
|
138 fBunny(a)
|
|
139 {}
|
|
140
|
|
141 int fBunnyPublic;
|
|
142
|
|
143 bool testAccess();
|
|
144
|
|
145 protected:
|
|
146 bool fBunnyProtected;
|
|
147
|
|
148 private :
|
|
149 bool fBunnyPrivate;
|
|
150
|
|
151 };
|
|
152
|
|
153 // Nothing specified means private.
|
|
154 class bugalope : /* private*/ animal::quadruped {
|
|
155
|
|
156 public:
|
|
157 bugalope(int a) : animal::quadruped(),
|
|
158 fBug(a)
|
|
159 {}
|
|
160
|
|
161 int fBugPublic;
|
|
162
|
|
163 bool testAccess();
|
|
164 protected:
|
|
165 bool fBugProtected;
|
|
166
|
|
167 private :
|
|
168 bool fBugPrivate;
|
|
169
|
|
170 };
|
|
171
|
|
172
|
|
173 };
|
|
174
|
|
175 #endif
|
105377
|
176
|
|
177 // arch-tag: e292a1d5-5434-4b4d-8e0e-808101ad84b6
|