aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/typedef_inherit.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/typedef_inherit.i')
-rw-r--r--Examples/test-suite/typedef_inherit.i41
1 files changed, 41 insertions, 0 deletions
diff --git a/Examples/test-suite/typedef_inherit.i b/Examples/test-suite/typedef_inherit.i
new file mode 100644
index 000000000..c22253a32
--- /dev/null
+++ b/Examples/test-suite/typedef_inherit.i
@@ -0,0 +1,41 @@
+// Inheritance through a typedef name
+%module typedef_inherit
+
+%inline %{
+class Foo {
+public:
+ virtual char *blah() {
+ return (char *) "Foo::blah";
+ }
+};
+
+typedef Foo FooObj;
+
+class Bar : public FooObj {
+ public:
+ virtual char *blah() {
+ return (char *) "Bar::blah";
+ };
+};
+
+char *do_blah(FooObj *f) {
+ return f->blah();
+}
+
+typedef struct {
+ virtual char *blah() {
+ return (char *) "Spam::blah";
+ }
+} Spam;
+
+struct Grok : public Spam {
+ virtual char *blah() {
+ return (char *) "Grok::blah";
+ }
+};
+
+char *do_blah2(Spam *s) {
+ return s->blah();
+}
+%}
+