PageRenderTime 15ms CodeModel.GetById 9ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/test-suite/typedef_inherit.i

#
Swig | 49 lines | 38 code | 11 blank | 0 comment | 0 complexity | 57bbac275a0dfc557e28b7f8d9a68f81 MD5 | raw file
 1// Inheritance through a typedef name
 2%module typedef_inherit
 3
 4  
 5%inline %{
 6class Foo {
 7public:
 8     virtual ~Foo () { }
 9  
10     virtual char *blah() {
11	return (char *) "Foo::blah";
12     }
13};
14
15typedef Foo FooObj;
16
17class Bar : public FooObj {
18 public:
19  virtual char *blah() {
20    return (char *) "Bar::blah";
21  };
22};
23
24char *do_blah(FooObj *f) {
25  return f->blah();
26}
27
28typedef struct spam {
29  virtual ~spam()
30  {
31  }
32  
33   virtual char *blah() {     
34       return (char *) "Spam::blah";
35   }
36} Spam;
37
38struct Grok : public Spam {
39   virtual ~Grok() { }
40   virtual char *blah() {
41       return (char *) "Grok::blah";
42   }
43};
44
45static char * do_blah2(Spam *s) {
46   return s->blah();
47}
48%}
49