diff options
Diffstat (limited to 'tests/accept/compile/tobject2.nim')
-rw-r--r-- | tests/accept/compile/tobject2.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/accept/compile/tobject2.nim b/tests/accept/compile/tobject2.nim new file mode 100644 index 000000000..8f69a6bac --- /dev/null +++ b/tests/accept/compile/tobject2.nim @@ -0,0 +1,21 @@ +# Tests the object implementation + +type + TPoint2d = object + x, y: int + + TPoint3d = object of TPoint2d + z: int # added a field + +proc getPoint( p: var TPoint2d) = + {.breakpoint.} + writeln(stdout, p.x) + +var + p: TPoint3d + +TPoint2d(p).x = 34 +p.y = 98 +p.z = 343 + +getPoint(p) |