update NOTICE and LICENSE
[nit.git] / tests / base_attr6.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 var foo: Int = 1
19 var bar: Int = 2
20 var baz: Int = 3
21 var vaz: Int = 4
22 end
23
24 class B
25 super A
26 redef fun foo: Int do return super + 10
27 redef fun bar=(i: Int)
28 do
29 '#'.output
30 i.output
31 super(i+20)
32 end
33 redef fun baz: Int do return super + 30
34 redef fun baz=(i: Int)
35 do
36 '#'.output
37 i.output
38 super(i+30)
39 end
40 redef var vaz: Int redef writable = 40
41 end
42
43 var b = new B
44 b.foo.output
45 b.foo = 100
46 b.foo.output
47 '\n'.output
48 b.bar.output
49 b.bar = 200
50 b.bar.output
51 '\n'.output
52 b.baz.output
53 b.baz = 300
54 b.baz.output
55 '\n'.output
56 b.vaz.output
57 b.vaz = 400
58 b.vaz.output