add multiple_inheritance example from Salvaire. It's working
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6577 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ad3b351313
commit
f4646cc5a0
5 changed files with 77 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ funcptr
|
||||||
import
|
import
|
||||||
mpointer
|
mpointer
|
||||||
multimap
|
multimap
|
||||||
|
multiple_inheritance
|
||||||
pointer
|
pointer
|
||||||
reference
|
reference
|
||||||
simple
|
simple
|
||||||
|
|
|
||||||
19
SWIG/Examples/perl5/multiple_inheritance/Makefile
Normal file
19
SWIG/Examples/perl5/multiple_inheritance/Makefile
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
TOP = ../..
|
||||||
|
SWIG = $(TOP)/../swig
|
||||||
|
CXXSRCS =
|
||||||
|
TARGET = example
|
||||||
|
INTERFACE = example.i
|
||||||
|
LIBS =
|
||||||
|
|
||||||
|
all::
|
||||||
|
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||||
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp
|
||||||
|
|
||||||
|
static::
|
||||||
|
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||||
|
TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static
|
||||||
|
|
||||||
|
clean::
|
||||||
|
$(MAKE) -f $(TOP)/Makefile perl5_clean
|
||||||
|
|
||||||
|
check: all
|
||||||
32
SWIG/Examples/perl5/multiple_inheritance/example.h
Normal file
32
SWIG/Examples/perl5/multiple_inheritance/example.h
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* File : example.h */
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void bar ()
|
||||||
|
{
|
||||||
|
cout << "bar" << endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void foo ()
|
||||||
|
{
|
||||||
|
cout << "foo" << endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Foo_Bar : public Foo, public Bar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void fooBar ()
|
||||||
|
{
|
||||||
|
cout << "foobar" << endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
9
SWIG/Examples/perl5/multiple_inheritance/example.i
Normal file
9
SWIG/Examples/perl5/multiple_inheritance/example.i
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* File : example.i */
|
||||||
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include "example.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
/* Let's just grab the original header file here */
|
||||||
|
%include "example.h"
|
||||||
16
SWIG/Examples/perl5/multiple_inheritance/runme.pl
Normal file
16
SWIG/Examples/perl5/multiple_inheritance/runme.pl
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# file: runme.pl
|
||||||
|
|
||||||
|
# This file test multiple inheritance
|
||||||
|
|
||||||
|
use example;
|
||||||
|
|
||||||
|
$foo_Bar = new example::Foo_Bar();
|
||||||
|
|
||||||
|
print "must be foo: ";
|
||||||
|
$foo_Bar->foo();
|
||||||
|
|
||||||
|
print "must be bar: ";
|
||||||
|
$foo_Bar->bar();
|
||||||
|
|
||||||
|
print "must be foobar: ";
|
||||||
|
$foo_Bar->fooBar();
|
||||||
Loading…
Add table
Add a link
Reference in a new issue