comparison tests/mini/classes1.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 tangotests/classes1.d@2df270e1ba59
children
comparison
equal deleted inserted replaced
340:351c0077d0b3 341:1bb99290e03a
1 module tangotests.classes1;
2
3 class Outer
4 {
5 int data;
6
7 class Inner
8 {
9 long data;
10
11 this(long d)
12 {
13 data = d*2;
14 }
15 }
16
17 void func()
18 {
19 auto i = new Inner(data);
20 data += (i.data/4);
21 }
22
23 this(int d)
24 {
25 data = d;
26 }
27 }
28
29 void main()
30 {
31 scope c = new Outer(100);
32 c.func();
33 int d = c.data;
34 printf("150 = %d\n", d);
35 }
36
37 extern(C) int printf(char*, ...);