syntax: 'meth' -> 'fun', 'attr' -> 'var'
[nit.git] / tests / base_sig_inh.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 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 kernel
18
19 class A
20 fun f0 is abstract
21 fun f1(a,b: Int) is abstract
22 fun f2(a,b: Int) is abstract
23 fun f3(a,b: Int): Int is abstract
24 fun f4: Int is abstract
25 end
26
27 class B
28 special A
29 redef fun f0 do 0.output
30 redef fun f1(a: Int, b: Int) do (a+b).output
31 redef fun f2(a,b) do (a+b).output
32 redef fun f3(a,b) do return a+b
33 redef fun f4 do return 4
34 init do end
35 end
36
37
38 fun m1 do 1.output
39 fun m2(a:Int) do a.output
40 fun m3(a,b:Int) do (a+b).output
41 #alt1#fun e1(a,b:Int...) do (a.first).output
42
43 m1
44 m2(2)
45 m3(1,2)
46 #alt1#e1(4,5)
47
48 var b = new B
49 b.f0
50 b.f1(0,1)
51 b.f2(1,1)
52 b.f3(1,2).output
53 b.f4.output