The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5fcae5eb66
commit
12a43edc2d
1508 changed files with 125983 additions and 44037 deletions
40
Examples/test-suite/template_inherit.i
Normal file
40
Examples/test-suite/template_inherit.i
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* File : example.i */
|
||||
%module template_inherit
|
||||
|
||||
/* This example tests template inheritance to see if it actually works */
|
||||
|
||||
%inline %{
|
||||
|
||||
template<class T> class Foo {
|
||||
public:
|
||||
virtual char *blah() {
|
||||
return (char *) "Foo";
|
||||
}
|
||||
virtual char *foomethod() {
|
||||
return (char *) "foomethod";
|
||||
}
|
||||
};
|
||||
|
||||
template<class T> class Bar : public Foo<T> {
|
||||
public:
|
||||
virtual char *blah() {
|
||||
return (char *) "Bar";
|
||||
}
|
||||
};
|
||||
|
||||
template<class T> char *invoke_blah(Foo<T> *x) {
|
||||
return x->blah();
|
||||
}
|
||||
%}
|
||||
|
||||
%template(FooInt) Foo<int>;
|
||||
%template(FooDouble) Foo<double>;
|
||||
%template(FooUInt) Foo<unsigned int>;
|
||||
%template(BarInt) Bar<int>;
|
||||
%template(BarDouble) Bar<double>;
|
||||
%template(BarUInt) Bar<unsigned>;
|
||||
%template(invoke_blah_int) invoke_blah<int>;
|
||||
%template(invoke_blah_double) invoke_blah<double>;
|
||||
%template(invoke_blah_uint) invoke_blah<int unsigned>;
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue