Debian Codegraph @

src/test/01-Basic/200-inner-class.ck

raw
1 // experimental feature: nested class definitions
2
3 class Outer
4 {
5 1 => int x;
6
7 // this works?!
8 class Inner
9 {
10 2 => int y;
11
12 fun void foo()
13 {
14 <<< "in inner class, y =", y >>>;
15 }
16 }
17
18 // this works?!
19 Inner inner;
20
21 fun void bar()
22 {
23 3 => inner.y;
24 inner.foo();
25
26 Inner barin;
27 5 => barin.y;
28 barin.foo();
29 }
30 }
31
32 Outer outer;
33 <<< outer.x >>>;
34 // this works?
35 <<< outer.inner.y >>>;
36 // this works?
37 outer.inner.foo();
38 // call bar, which operates with Outer and Inner
39 outer.bar();
40
41
42 // this doesn't work, but should it?
43 // Outer.Inner x;