First NIT release and new clean mercurial repository
[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 class Object
20 end
21
22 class Int
23 meth output is intern
24 end
25
26 class Foo
27 readable writable attr _a1: Int
28 readable writable attr _a2: Int
29 meth run
30 do
31 a1.output
32 a2.output
33 end
34
35 init
36 do
37 a1 = 1
38 a2 = 2
39 end
40 end
41
42 class Bar
43 special Foo
44 readable writable attr _a3: Int
45 redef meth run
46 do
47 a1.output
48 a2.output
49 a3.output
50 end
51
52 redef init
53 do
54 a1 = 10
55 a2 = 20
56 a3 = 30
57 end
58 end
59
60 var f = new Foo
61 var b = new Bar
62 f.run
63 b.run