detecting polymorphic virtual methods properly
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5511 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
86edc68494
commit
8199b93d1d
6 changed files with 206 additions and 3 deletions
36
SWIG/Examples/test-suite/python/director_detect_runme.py
Normal file
36
SWIG/Examples/test-suite/python/director_detect_runme.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import director_detect
|
||||
|
||||
class MyBar(director_detect.Bar):
|
||||
def __init__(self, val = 2):
|
||||
director_detect.Bar.__init__(self)
|
||||
self.val = val
|
||||
|
||||
def get_value(self):
|
||||
self.val += 1
|
||||
return self.val
|
||||
|
||||
def get_class(self):
|
||||
self.val += 1
|
||||
return director_detect.A()
|
||||
|
||||
def just_do_it(self):
|
||||
self.val += 1
|
||||
|
||||
def clone(self):
|
||||
return MyBar(self.val)
|
||||
pass
|
||||
|
||||
|
||||
b = MyBar()
|
||||
|
||||
f = b.base()
|
||||
|
||||
v = f.get_value()
|
||||
a = f.get_class()
|
||||
f.just_do_it()
|
||||
|
||||
c = b.clone()
|
||||
vc = c.get_value()
|
||||
|
||||
if (v != 3) or (b.val != 5) or (vc != 6):
|
||||
raise RuntimeError,"Bad virtual detection"
|
||||
Loading…
Add table
Add a link
Reference in a new issue