Mercurial > lcfOS
annotate python/c3/examples/types.c3 @ 259:ac603eb66b63
Added function call
author | Windel Bouwman |
---|---|
date | Mon, 05 Aug 2013 20:41:25 +0200 |
parents | 81752b0f85a5 |
children |
rev | line source |
---|---|
237 | 1 |
2 /* | |
3 Demo of how to define types | |
4 */ | |
5 | |
6 package typedemo; | |
7 | |
8 type int A; | |
9 type int B; | |
10 type struct { | |
11 int x, y; | |
12 A z; | |
13 } C; | |
14 type struct { | |
15 C x; | |
16 B y; | |
17 int z; | |
18 } D; | |
19 | |
20 type D* E; | |
21 | |
22 function int testcast() | |
23 { | |
24 var A a; | |
25 var B b; | |
26 a = 3; | |
27 b = a; | |
28 var C c; | |
29 c.x = a; | |
30 c.z = c.y; | |
31 var D d; | |
32 var E e; | |
33 var D* e2; | |
34 e = &d; | |
35 e2 = e; | |
36 e2->x.x = 22; | |
37 | |
38 return 0; | |
39 } | |
40 |