PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/test-suite/typedef_inherit.i

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