Rename REAMDE to README.md
[nit.git] / tests / base_attr_abstract.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 interface Foo
18 var a: Object is abstract
19 #alt1#var b = 1 is abstract
20 #alt2#var b is abstract, noautoinit
21 end
22
23 class Bar
24 super Foo
25 redef var a
26 end
27
28 class Baz
29 super Foo
30 redef fun a do return 100
31 redef fun a=(x) do (101).output
32 end
33
34 class FooBar
35 super Foo
36 end
37
38 var f: Foo = new Bar(1)
39 f.a.output
40 f.a = 2
41 f.a.output
42
43 f = new Baz
44 f.a.output
45 f.a = 3
46 f.a.output
47
48 f = new FooBar
49 #alt3#f.a.output
50 #alt4#f.a = 4