Mercurial > projects > ldc
comparison test/innerclass1.d @ 123:7f9a0a58394b trunk
[svn r127] Updated the lphobos build scripts a little. Created a new rebuild profile.
Removed some potentially very long logging lines.
Added support for inner classes.
author | lindquist |
---|---|
date | Wed, 28 Nov 2007 03:01:51 +0100 |
parents | |
children | d9d5d59873d8 |
comparison
equal
deleted
inserted
replaced
122:36ab367572df | 123:7f9a0a58394b |
---|---|
1 module innerclass1; | |
2 | |
3 class Outer | |
4 { | |
5 int i; | |
6 class Inner | |
7 { | |
8 int func() | |
9 { | |
10 return i; | |
11 } | |
12 } | |
13 } | |
14 | |
15 void main() | |
16 { | |
17 Outer o = new Outer; | |
18 { | |
19 o.i = 42; | |
20 { | |
21 auto i = o.new Inner; | |
22 { | |
23 int x = i.func(); | |
24 assert(x == 42); | |
25 } | |
26 } | |
27 } | |
28 printf("SUCCESS\n"); | |
29 } |