added the ruby runtime case and more comments.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5584 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8cc5b25f18
commit
575a54adfd
3 changed files with 52 additions and 3 deletions
|
|
@ -1,9 +1,11 @@
|
|||
import virtual_poly
|
||||
|
||||
|
||||
d = virtual_poly.NDouble(3.5)
|
||||
i = virtual_poly.NInt(2)
|
||||
|
||||
#
|
||||
# the copy methods return the right polymorphic types
|
||||
#
|
||||
dc = d.copy()
|
||||
ic = i.copy()
|
||||
|
||||
|
|
@ -14,6 +16,14 @@ if i.get() != ic.get():
|
|||
raise RuntimeError
|
||||
|
||||
|
||||
ddc = virtual_poly.NDouble_dynamic_cast(dc)
|
||||
#
|
||||
# here this dynamic_cast is not needed at all,
|
||||
# but works fine anyway ('nnumber()' returns a NNumber).
|
||||
#
|
||||
ddc = virtual_poly.NDouble_dynamic_cast(dc.nnumber())
|
||||
if d.get() != ddc.get():
|
||||
raise RuntimeError
|
||||
|
||||
dic = virtual_poly.NInt_dynamic_cast(ic.nnumber())
|
||||
if i.get() != dic.get():
|
||||
raise RuntimeError
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue