src/test/01-Basic/79-cast-to-child.ck
raw| 1 | // this tests casting to a child pointer |
| 2 | // NOTE as of 1.5.2.0, chuck performs runtime cast verification |
| 3 | // see test/06-Errors/error-runtime-cast.ck for an error case |
| 4 | |
| 5 | // a subclass of Event |
| 6 | class Foo extends Event { } |
| 7 | |
| 8 | // an Foo as Event |
| 9 | new Foo @=> Event @ e; |
| 10 | |
| 11 | // cast to subclass |
| 12 | e $ Foo @=> Foo @ f; |
| 13 | |
| 14 | // if we got here then ok |
| 15 | <<< "success" >>>; |