add director example
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7064 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d75313afe0
commit
2647cb35a8
1 changed files with 21 additions and 0 deletions
|
|
@ -2329,6 +2329,7 @@ the methods one() and two() (but not three()):
|
|||
%feature("director") Foo;
|
||||
class Foo {
|
||||
public:
|
||||
Foo(int foo);
|
||||
virtual void one();
|
||||
virtual void two();
|
||||
};
|
||||
|
|
@ -2340,8 +2341,28 @@ public:
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
then at the python side you can define
|
||||
</p>
|
||||
|
||||
<div class="targetlang">
|
||||
<pre>
|
||||
import mymodule
|
||||
|
||||
class MyFoo(mymodule.Foo):
|
||||
def __init__(self, foo):
|
||||
mymodule.Foo(self, foo)
|
||||
|
||||
def one(self):
|
||||
print "one from python"
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<H3><a name="Python_nn34"></a>26.5.2 Director classes</H3>
|
||||
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
For each class that has directors enabled, SWIG generates a new class
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue