diff options
Diffstat (limited to 'tests/tobject2.nim')
-rwxr-xr-x | tests/tobject2.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/tobject2.nim b/tests/tobject2.nim new file mode 100755 index 000000000..2853adc28 --- /dev/null +++ b/tests/tobject2.nim @@ -0,0 +1,24 @@ +# Tests the object implementation + +import + io + +type + TPoint2d = object + x, y: int + + TPoint3d = object of TPoint2d + z: int # added a field + +proc getPoint(var p: TPoint2d) = + {.breakpoint.} + writeln(stdout, p.x) + +var + p: TPoint3d + +TPoint2d(p).x = 34 +p.y = 98 +p.z = 343 + +getPoint(p) |