Mercurial > projects > ldc
comparison tests/mini/classes6.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 | test/classes6.d@d9d5d59873d8 |
children | 44f08170f4ef |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module classes6; | |
2 extern(C) int printf(char*, ...); | |
3 | |
4 class C | |
5 { | |
6 void f() | |
7 { | |
8 printf("world\n"); | |
9 } | |
10 } | |
11 | |
12 class D : C | |
13 { | |
14 void f() | |
15 { | |
16 printf("moon\n"); | |
17 } | |
18 } | |
19 | |
20 | |
21 extern(C) | |
22 { | |
23 void srand(uint seed); | |
24 int rand(); | |
25 } | |
26 | |
27 import llvm.intrinsic; | |
28 | |
29 void main() | |
30 { | |
31 C c; | |
32 srand(readcyclecounter()); | |
33 if (rand() % 2) | |
34 c = new C; | |
35 else | |
36 c = new D; | |
37 c.f(); | |
38 } |