source:
trunk/testcase/456/simplecpp.cpp@
1187
| Last change on this file since 1187 was 314, checked in by , 23 years ago | |
|---|---|
|
|
| File size: 971 bytes | |
| Rev | Line | |
|---|---|---|
| [314] | 1 | /* verify that one can step thru all the code and that the this and obj variables make sense. */ |
| [302] | 2 | #define USE_INLINE |
| [300] | 3 | class foo |
| 4 | { | |
| [301] | 5 | char ch; |
| [300] | 6 | public: |
| [301] | 7 | #ifdef USE_INLINE |
| [300] | 8 | foo() |
| [301] | 9 | { |
| 10 | ch = 'k'; | |
| [302] | 11 | int ch2 = 1; |
| 12 | ch += ch2; | |
| 13 | int ch3 = 1; | |
| 14 | ch += ch3; | |
| 15 | #if 1 | |
| 16 | if (ch == 123) | |
| 17 | { | |
| 18 | int ch4 = 23; | |
| 19 | ch -= ch4; | |
| 20 | } | |
| 21 | #endif | |
| [301] | 22 | } |
| [314] | 23 | |
| 24 | virtual ~foo() | |
| 25 | { | |
| 26 | ch = 0; | |
| 27 | } | |
| 28 | ||
| 29 | virtual void set(int ch) | |
| 30 | { | |
| 31 | this->ch = ch; | |
| 32 | } | |
| 33 | ||
| [301] | 34 | #else |
| 35 | foo(); | |
| [314] | 36 | virtual ~foo(); |
| 37 | virtual void set(int ch); | |
| 38 | ||
| [301] | 39 | #endif |
| [300] | 40 | }; |
| 41 | ||
| [301] | 42 | #ifndef USE_INLINE |
| 43 | foo::foo() | |
| 44 | { | |
| 45 | ch = 'k'; | |
| [302] | 46 | int ch2 = 1; |
| 47 | ch += ch2; | |
| 48 | int ch3 = 1; | |
| 49 | ch += ch3; | |
| 50 | #if 0 | |
| 51 | if (ch == 123) | |
| 52 | { | |
| 53 | int ch4 = 23; | |
| 54 | ch -= ch4; | |
| 55 | } | |
| 56 | #endif | |
| [301] | 57 | } |
| [314] | 58 | |
| 59 | foo::~foo() | |
| 60 | { | |
| 61 | ch = 0; | |
| 62 | } | |
| 63 | ||
| 64 | void foo::set(int ch) | |
| 65 | { | |
| 66 | this->ch = ch; | |
| 67 | } | |
| [301] | 68 | #endif |
| [300] | 69 | |
| [301] | 70 | |
| [300] | 71 | int main(int argc, char **argv) |
| 72 | { | |
| 73 | foo obj; | |
| [314] | 74 | obj.set('k'); |
| [300] | 75 | return 0; |
| 76 | } |
Note:
See TracBrowser
for help on using the repository browser.
