Mercurial > projects > ldc
comparison tests/mini/classes12.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 class C | |
2 { | |
3 int a; | |
4 union | |
5 { | |
6 int i; | |
7 double d; | |
8 } | |
9 int z; | |
10 } | |
11 | |
12 void func() | |
13 { | |
14 scope c = new C; | |
15 access1(c); | |
16 assert(c.i == 42); | |
17 access2(c); | |
18 assert(c.d == 2.5); | |
19 } | |
20 | |
21 void access1(C c) | |
22 { | |
23 c.i = 42; | |
24 } | |
25 | |
26 void access2(C c) | |
27 { | |
28 c.d = 2.5; | |
29 } | |
30 | |
31 void main() | |
32 { | |
33 func(); | |
34 } |