1 %module(directors="1",dirprot="1") director_using 2 3 %warnfilter(SWIGWARN_PHP_PUBLIC_BASE) FooBar; 4 5 %{ 6 #include <string> 7 #include <iostream> 8 %} 9 10 %include "std_string.i" 11 12 %feature("director"); 13 14 %newobject *::create(); 15 16 %inline { 17 template <class C> 18 class Foo { 19 public: ~Foo()20 virtual ~Foo() {} 21 advance()22 std::string advance() 23 { 24 return "Foo::advance;" + do_advance(); 25 } 26 27 protected: 28 virtual std::string do_advance() = 0; 29 virtual std::string do_step() const = 0; 30 }; 31 } 32 33 %template(Foo_int) Foo<int>; 34 35 %inline { 36 37 class Bar : public Foo<int> 38 { 39 public: 40 step()41 std::string step() 42 { 43 return "Bar::step;" + advance(); 44 } 45 46 47 using Foo<int>::do_step; 48 protected: do_advance()49 std::string do_advance() 50 { 51 return "Bar::do_advance;" + do_step(); 52 } 53 54 }; 55 56 template <class C> 57 class FooBar : public Bar 58 { 59 public: 60 virtual C get_value() const = 0; 61 using Bar::do_advance; 62 }; 63 64 } 65 66 %template(FooBar_int) FooBar<int>; 67 68 %inline %{ 69 struct SomeBase { ~SomeBaseSomeBase70 virtual ~SomeBase() {} method1SomeBase71 virtual void method1() {} method2SomeBase72 virtual void method2() {} 73 }; 74 75 struct PrivateDerived : SomeBase { 76 private: method1PrivateDerived77 virtual void method1() {} 78 using SomeBase::method2; 79 }; 80 %} 81