Debian Codegraph @

src/test/01-Basic/163-public-access.ck

raw
1 // verify access from within public class definitions
2 //
3 // SEE ALSO:
4 // 05-Global/98.ck
5 // 06-Errors/error-public-class-ext-var1.ck
6 // 06-Errors/error-public-class-ext-var2.ck
7
8 // public classes can be instantiated from any file
9 public class X
10 {
11 // member variable
12 5 => int myNum;
13
14 fun void go()
15 {
16 // roundabout way
17 if( go2() == 12 )
18 Machine.eval( "<<<\"success\">>>;" );
19 }
20
21 fun int go2()
22 {
23 return myNum + 7;
24 }
25 }
26
27 // instantiate
28 X x;
29 // call
30 x.go();