Debian Codegraph @

terps/tads/tads3/test/data/cre_inst.t

raw
1 /*
2 * test of TadsObject.createInstance
3 */
4
5 class Item: object
6 construct(x)
7 {
8 value = x;
9 }
10 generator(x)
11 {
12 return self.createInstance(x);
13 }
14 value = nil
15 ;
16
17 class BlueItem: Item
18 color = 'blue'
19 ;
20
21 class RedItem: Item
22 color = 'red'
23 ;
24
25 main(args)
26 {
27 local x;
28
29 x = RedItem.generator(1);
30 "red item color = <<x.color>>, value = <<x.value>>\n";
31
32 x = BlueItem.generator(2);
33 "blue item color = <<x.color>>, value = <<x.value>>\n";
34 }
35