Merge: doc: fixed some typos and other misc. corrections
[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,5#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 #alt5#autoinit c=, e=
52 end
53
54 class G
55 super D
56 super E
57 var g: Int
58 init do 'g'.output #alt2#
59 #alt5#autoinit c=, e=, g=
60 end
61
62 class H
63 super F
64 super G
65 init do 'h'.output #alt1,2#
66 end
67
68
69 var a = new A
70 '\n'.output
71
72 var b = new B
73 '\n'.output
74
75 var c = new C(1)
76 '\n'.output
77 c.c.output
78
79 var d = new D(2)
80 '\n'.output
81 d.c.output
82
83 var e = new E(3, 30)
84 '\n'.output
85 e.c.output
86 e.e.output
87
88 var f = new F(4, 40)
89 '\n'.output
90 f.c.output
91 f.e.output
92
93 var g = new G(5, 50, 500)
94 '\n'.output
95 g.c.output
96 g.e.output
97 g.g.output
98
99 var h = new H(6, 60, 600)
100 '\n'.output
101 h.c.output
102 h.e.output
103 h.g.output