src/test/06-Errors/error-super-not-assign.ck
raw| 1 | class Parent |
| 2 | { |
| 3 | fun Parent() |
| 4 | { |
| 5 | <<< "Parent ctor" >>>; |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | class Child extends Parent |
| 10 | { |
| 11 | fun Child() |
| 12 | { |
| 13 | <<< "Child ctor" >>>; |
| 14 | } |
| 15 | |
| 16 | fun void test() |
| 17 | { |
| 18 | <<< "Test start" >>>; |
| 19 | |
| 20 | // should throw compile error since super is not be assignable |
| 21 | (this $ Parent) @=> super; |
| 22 | |
| 23 | <<< "Test complete" >>>; |
| 24 | } |
| 25 | |
| 26 | fun void not_override() |
| 27 | { |
| 28 | <<< "Child not_override" >>>; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | Child child; |
| 33 | child.test(); |