File tree 2 files changed +23
-28
lines changed
2 files changed +23
-28
lines changed Original file line number Diff line number Diff line change
1
+ -- Tested and passed. --
2
+ -- Jianxiong Cai 14 Jun, 2018 --
3
+
1
4
class Main {
2
5
a : Int <- 1 ;
3
6
b : Main ;
Original file line number Diff line number Diff line change 1
- class Int 3 inherits Int 2{
1
+ -- Tested and passed. --
2
+ -- Jianxiong Cai 14 Jun, 2018 --
2
3
3
- bar2 ( x : Bool , y : Int ): Int {
4
- 1
5
- } ;
4
+ class Main {
5
+ a : A <- new A ;
6
+ b : B <- new B ;
6
7
7
- foo (x : Bool , y :Int ): Int {
8
- 2
9
- };
8
+ cout : IO <- new IO ;
10
9
11
- ba3 (x : Bool , y :Int ): Int {
12
- 1
13
- };
10
+ main (): Int {{
11
+ b .getA ();
12
+ a .getA ();
13
+ b @A .getA ();
14
+ 1 ;
15
+ }};
14
16
};
15
17
16
- class Int 2{
17
- a2 : Int ;
18
-
19
- foo (x : Bool , y :Int ): Int {
20
- 1
21
- };
18
+ class A {
19
+ a : Int <- 1 ;
20
+ cout2 : IO <- new IO ;
21
+ getA (): Int {{ cout2 .out_string ("A.getA get called\n" ); a ; }};
22
22
};
23
23
24
- class Main {
25
- a : Int 3 <- new Int 3;
26
-
27
- bar (x : Bool , y :Int ): Int {
28
- 1
29
- };
30
-
31
- main (): Int {{
32
- a @Int 2.foo (true ,1 );
33
- 0 ;
34
- }};
35
- };
24
+ class B inherits A {
25
+ incA (): Int {{ a <- a + 1 ; 10 ; }};
26
+ getA (): Int {{ cout2 .out_string ("B.getA get called\n" ); a ; }};
27
+ };
You can’t perform that action at this time.
0 commit comments