[Swig-dev] Limited Support for Multiple Inheritance in SWIG/Ruby

Wait! (Replying to myself :wink:

I had temporarily forgotten that a Class is-a Module, so maybe there's no
problem after all. I just wrap all of the base classes (Base1, Base2 and
Base3) normally and then mix the "non-primary" base classes into Derived, e.g.

    class Base1; end
    class Base2; end
    class Base3; end

    class Derived < Base1
      include Base2
      include Base3
    end

That should do the trick, right? Even better!

Lyle

That should do the trick, right? Even better!

Just test with ruby what you have written :-))

Guy Decoux

ts wrote:

Just test with ruby what you have written :-))

Oh, well :wink: I hoped I had found a quick and elegant solution to the
problem, but as Guy points out:

 $ cat hopeful.rb
 class Base1; end

 class Base2; end

 class Derived < Base1
   include Base2
 end

 $ ruby hopeful.rb
 hopeful.rb:6:in `include': wrong argument type Class (expected 

Module) (TypeError)
from hopeful.rb:6

I’m sure there’s a good reason, but why this restriction?