add silly abstract case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6476 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b83fe6bd77
commit
628916c794
2 changed files with 42 additions and 0 deletions
|
|
@ -22,3 +22,31 @@ public:
|
||||||
virtual std::string pong() { return "Foo::pong();" + ping(); }
|
virtual std::string pong() { return "Foo::pong();" + ping(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%feature("director") Example1;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
class Example1
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int xsize, ysize;
|
||||||
|
int fontsize;
|
||||||
|
int fontdim[23];
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
Example1()
|
||||||
|
: xsize(200), ysize(200) { }
|
||||||
|
|
||||||
|
virtual ~Example1() {}
|
||||||
|
|
||||||
|
int GetXSize() const { return xsize; }
|
||||||
|
|
||||||
|
// pure virtual methods that must be overridden
|
||||||
|
virtual int Color(unsigned char r, unsigned char g, unsigned char b) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import director_abstract
|
import director_abstract
|
||||||
|
|
||||||
class MyFoo(director_abstract.Foo):
|
class MyFoo(director_abstract.Foo):
|
||||||
|
def __init__(self):
|
||||||
|
director_abstract.Foo.__init__(self)
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return "MyFoo::ping()"
|
return "MyFoo::ping()"
|
||||||
|
|
||||||
|
|
@ -14,3 +16,15 @@ if a.pong() != "Foo::pong();MyFoo::ping()":
|
||||||
raise RuntimeError, a.pong()
|
raise RuntimeError, a.pong()
|
||||||
|
|
||||||
|
|
||||||
|
class MyExample(director_abstract.Example1):
|
||||||
|
def __init__(self):
|
||||||
|
director_abstract.Example1.__init__(self)
|
||||||
|
pass
|
||||||
|
|
||||||
|
def Color(self, r, g, b):
|
||||||
|
return r
|
||||||
|
|
||||||
|
me = MyExample()
|
||||||
|
|
||||||
|
print me.Color(1,2,3)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue