Rename REAMDE to README.md
[nit.git] / tests / base_init_basic.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import kernel
16
17 class A
18 init do 'a'.output #alt1,2#
19 end
20
21 class B
22 super A
23 init do 'b'.output #alt1,2#
24 end
25
26 class C
27 super A
28 var c: Int
29 init do 'c'.output #alt2#
30 end
31
32 class D
33 super B
34 super C
35 #alt3#var b: Int
36 #alt4#var b = 11
37 init do 'd'.output #alt2#
38 end
39
40 class E
41 super B
42 super C
43 var e: Int
44 init do 'e'.output #alt1,2#
45 end
46
47 class F
48 super D
49 super E
50 init do 'f'.output #alt1,2#
51 end
52
53 class G
54 super D
55 super E
56 var g: Int
57 init do 'g'.output #alt2#
58 end
59
60 class H
61 super F
62 super G
63 init do 'h'.output #alt1,2#
64 end
65
66
67 var a = new A
68 '\n'.output
69
70 var b = new B
71 '\n'.output
72
73 var c = new C(1)
74 '\n'.output
75 c.c.output
76
77 var d = new D(2)
78 '\n'.output
79 d.c.output
80
81 var e = new E(3, 30)
82 '\n'.output
83 e.c.output
84 e.e.output
85
86 var f = new F(4, 40)
87 '\n'.output
88 f.c.output
89 f.e.output
90
91 var g = new G(5, 50, 500)
92 '\n'.output
93 g.c.output
94 g.e.output
95 g.g.output
96
97 var h = new H(6, 60, 600)
98 '\n'.output
99 h.c.output
100 h.e.output
101 h.g.output