Debian Codegraph @

examples/func/func_overload_member.ck

raw
1 // 34.ck : function overloading
2
3 // declare class
4 class X
5 {
6 // delcare foo
7 fun void foo( int a )
8 { <<<a>>>; }
9
10 // delcare foo with different arguments
11 fun void foo( int a, int b )
12 { <<<"success">>>; }
13 }
14
15 // extend X
16 class Y extends X
17 {
18 fun void foo( int a )
19 { <<<a+1>>>; }
20 }
21
22 // instantiate a Y
23 Y y;
24
25 // call the right one, hopefully
26 y.foo( 3, 5 );