2 %module template_inherit
4 /* This example tests template inheritance to see if it actually works */
8 template<class T> class Foo {
11 virtual char *blah() {
12 return (char *) "Foo";
14 virtual char *foomethod() {
15 return (char *) "foomethod";
19 template<class T> class Bar : public Foo<T> {
21 virtual char *blah() {
22 return (char *) "Bar";
26 template<class T> char *invoke_blah(Foo<T> *x) {
31 %template(FooInt) Foo<int>;
32 %template(FooDouble) Foo<double>;
33 %template(FooUInt) Foo<unsigned int>;
34 %template(BarInt) Bar<int>;
35 %template(BarDouble) Bar<double>;
36 %template(BarUInt) Bar<unsigned>;
37 %template(invoke_blah_int) invoke_blah<int>;
38 %template(invoke_blah_double) invoke_blah<double>;
39 %template(invoke_blah_uint) invoke_blah<int unsigned>;