Debian Codegraph @

src/test/01-Basic/51.ck.disabled

raw
1 // 51.ck : function overloading
2
3 fun void bar()
4 {
5 <<<1>>>;
6 }
7
8 fun void bar( int i )
9 {
10 <<<2>>>;
11 }
12
13 fun void bar( string s )
14 {
15 <<<3>>>;
16 }
17
18
19 class X
20 {
21 fun void foo()
22 { <<<"X.foo()">>>; }
23
24 fun void foo( int i )
25 { <<<"X.foo(int)">>>; }
26
27 fun void foo( int a, int b )
28 { <<<"X.foo(int, int)">>>; }
29 }
30
31 class Y extends X
32 {
33 fun void foo()
34 { <<<"Y.foo()">>>; }
35
36 fun void foo( int a, int b )
37 { <<<"Y.foo(int, int)">>>; }
38 }
39
40 Y y;
41 y.foo();
42 y.foo( 1 );
43 y.foo( 1, 2 );
44
45 X x;
46 x.foo( 1, 2 );
47
48 bar();
49 bar(1);
50 bar("a");