Rename REAMDE to README.md
[nit.git] / tests / base_attr_def.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2005-2008 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 import end
18
19 interface Object
20 end
21
22 class Int
23 fun output is intern
24 end
25
26 class Foo
27 var a1: Int
28 var a2: Int
29 fun run
30 do
31 a1.output
32 a2.output
33 end
34
35 init is
36 old_style_init
37 do
38 a1 = 1
39 a2 = 2
40 end
41 end
42
43 class Bar
44 super Foo
45 var a3: Int
46 redef fun run
47 do
48 a1.output
49 a2.output
50 a3.output
51 end
52
53 init is
54 old_style_init
55 do
56 a1 = 10
57 a2 = 20
58 a3 = 30
59 end
60 end
61
62 var f = new Foo
63 var b = new Bar
64 f.run
65 b.run