summaryrefslogtreecommitdiff
path: root/trunk/Examples/perl5/multiple_inheritance
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/Examples/perl5/multiple_inheritance')
-rw-r--r--trunk/Examples/perl5/multiple_inheritance/Makefile19
-rw-r--r--trunk/Examples/perl5/multiple_inheritance/example.h31
-rw-r--r--trunk/Examples/perl5/multiple_inheritance/example.i9
-rw-r--r--trunk/Examples/perl5/multiple_inheritance/runme.pl16
4 files changed, 75 insertions, 0 deletions
diff --git a/trunk/Examples/perl5/multiple_inheritance/Makefile b/trunk/Examples/perl5/multiple_inheritance/Makefile
new file mode 100644
index 000000000..fcca38473
--- /dev/null
+++ b/trunk/Examples/perl5/multiple_inheritance/Makefile
@@ -0,0 +1,19 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-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
diff --git a/trunk/Examples/perl5/multiple_inheritance/example.h b/trunk/Examples/perl5/multiple_inheritance/example.h
new file mode 100644
index 000000000..a8f544898
--- /dev/null
+++ b/trunk/Examples/perl5/multiple_inheritance/example.h
@@ -0,0 +1,31 @@
+/* File : example.h */
+
+#include <iostream>
+
+using namespace std;
+
+class Bar
+{
+ public:
+ virtual void bar () {
+ cout << "bar" << endl;
+ }
+ virtual ~Bar() {}
+};
+
+class Foo
+{
+ public:
+ virtual void foo () {
+ cout << "foo" << endl;
+ }
+ virtual ~Foo() {}
+};
+
+class Foo_Bar : public Foo, public Bar
+{
+ public:
+ virtual void fooBar () {
+ cout << "foobar" << endl;
+ }
+};
diff --git a/trunk/Examples/perl5/multiple_inheritance/example.i b/trunk/Examples/perl5/multiple_inheritance/example.i
new file mode 100644
index 000000000..fbdf7249f
--- /dev/null
+++ b/trunk/Examples/perl5/multiple_inheritance/example.i
@@ -0,0 +1,9 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
diff --git a/trunk/Examples/perl5/multiple_inheritance/runme.pl b/trunk/Examples/perl5/multiple_inheritance/runme.pl
new file mode 100644
index 000000000..a1130c66e
--- /dev/null
+++ b/trunk/Examples/perl5/multiple_inheritance/runme.pl
@@ -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();