summary refs log tree commit diff stats
path: root/tests/objects/tobject2.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2014-01-26 01:38:45 +0200
committerZahary Karadjov <zahary@gmail.com>2014-01-26 01:38:45 +0200
commit5d712e0d3f9f5b8e486720c8bedd749656b527d8 (patch)
treec021fc94967717fb6fa56d50271655c99875ae94 /tests/objects/tobject2.nim
parent5a6030a16bf74ee7de92117c5b2d7310b8b36d28 (diff)
parentad74332a9221b17db84de6eca55f19b67a3ec81f (diff)
downloadNim-5d712e0d3f9f5b8e486720c8bedd749656b527d8.tar.gz
Merge branch 'devel' of https://www.github.com/Araq/Nimrod into devel
Diffstat (limited to 'tests/objects/tobject2.nim')
-rw-r--r--tests/objects/tobject2.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/objects/tobject2.nim b/tests/objects/tobject2.nim
new file mode 100644
index 000000000..0f1869695
--- /dev/null
+++ b/tests/objects/tobject2.nim
@@ -0,0 +1,21 @@
+# Tests the object implementation
+
+type
+  TPoint2d {.inheritable.} = 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)