update NOTICE and LICENSE
[nit.git] / tests / base_init_inherit.nit
1 import kernel
2
3 class A
4 init ca
5 do
6 'A'.output
7 end
8
9 init ca2
10 do
11 'A'.output
12 '2'.output
13 end
14
15 fun foo
16 do
17 'a'.output
18 '\n'.output
19 end
20 end
21
22 class B
23 super A
24 init cb
25 do
26 'B'.output
27 '{'.output
28 ca
29 '}'.output
30 end
31
32 redef fun foo
33 do
34 'b'.output
35 super
36 end
37 end
38
39 class C
40 super B
41 init cc
42 do
43 'C'.output
44 '{'.output
45 cb
46 '}'.output
47 end
48
49 redef fun foo
50 do
51 'c'.output
52 super
53 end
54 end
55
56 class M
57 super A
58 redef fun foo
59 do
60 'm'.output
61 super
62 end
63 end
64
65 class N
66 super B
67 super M
68 redef fun foo
69 do
70 'n'.output
71 super
72 end
73 end
74
75 class O
76 super N
77 super C
78 init co
79 do
80 'O'.output
81 '{'.output
82 cc
83 '}'.output
84 end
85 redef fun foo
86 do
87 'o'.output
88 super
89 end
90 end
91
92 (new A.ca).foo
93 (new A.ca2).foo
94 (new B.cb).foo
95 #alt1#(new B.ca).foo
96 #alt1#(new B.ca2).foo
97 (new C.cc).foo
98 #alt1#(new C.ca).foo
99 #alt1#(new C.ca2).foo
100 #alt1#(new C.cb).foo
101 (new M.ca).foo
102 (new M.ca2).foo
103 (new N.cb).foo
104 #alt1#(new N.ca).foo
105 #alt1#(new N.ca2).foo
106 (new O.co).foo
107 #alt1#(new O.ca).foo
108 #alt1#(new O.ca2).foo
109 #alt1#(new O.cb).foo
110 #alt1#(new O.cc).foo
111