Debian Codegraph @

src/test/01-Basic/24.ck

raw
1 // 24.ck : class with a member field and a member function
2
3 class X
4 {
5 // data
6 int i;
7
8 // function
9 public void foo( int a )
10 {
11 // set i
12 a => i;
13 }
14 }
15
16 // instantiate a X
17 X x;
18
19 // call
20 x.foo( 2 );
21
22 // test
23 if( x.i == 2 ) <<<"success">>>;