diff options
author | Araq <rumpf_a@web.de> | 2014-01-22 17:32:38 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-01-22 17:32:38 +0100 |
commit | 37229df7fc044fe108d2f4d88f127141cabeb6a6 (patch) | |
tree | 2dd7dbacaa4afecdd9c6bde5180c43df24b0a914 /tests/objects/tobject3.nim | |
parent | 85a5bfe60520a59ff9ce493dfa65bf9cbd86059e (diff) | |
download | Nim-37229df7fc044fe108d2f4d88f127141cabeb6a6.tar.gz |
next steps for closure iterators
Diffstat (limited to 'tests/objects/tobject3.nim')
-rw-r--r-- | tests/objects/tobject3.nim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/objects/tobject3.nim b/tests/objects/tobject3.nim new file mode 100644 index 000000000..935e6ca8c --- /dev/null +++ b/tests/objects/tobject3.nim @@ -0,0 +1,28 @@ +type + TFoo = ref object of TObject + Data: int + TBar = ref object of TFoo + nil + TBar2 = ref object of TBar + d2: int + +template super(self: TBar): TFoo = self + +template super(self: TBar2): TBar = self + +proc Foo(self: TFoo) = + echo "TFoo" + +#proc Foo(self: TBar) = +# echo "TBar" +# Foo(super(self)) +# works when this code is uncommented + +proc Foo(self: TBar2) = + echo "TBar2" + Foo(super(self)) + +var b: TBar2 +new(b) + +Foo(b) |