src/test/01-Basic/244-depend-member-var.ck
raw| 1 | // test declaring class members in a file below access |
| 2 | |
| 3 | class Foo |
| 4 | { |
| 5 | // member variable, declare above access in ctors |
| 6 | int m_a; |
| 7 | |
| 8 | // a constructor |
| 9 | fun @construct( int n ) { n => m_a => m_b; } |
| 10 | // another constructor |
| 11 | fun @construct( int a, int b ) { a => m_a; b => m_b; } |
| 12 | |
| 13 | // member variable, declare below access in ctrs |
| 14 | int m_b; |
| 15 | } |
| 16 | |
| 17 | // instantiate with |
| 18 | Foo foo( 1, 2 ); |
| 19 | |
| 20 | if( foo.m_a + foo.m_b == 3 ) <<< "success" >>>; |