Wilson Bilkovich wrote:
> On 1/9/07, Kumar Tnj <senvenit2003 / india.com> wrote:
> > Hi,
> >
> > Is ruby supports multiple inheritence.
> > I am the beginner of ruby.
> > simple code for ruby multiple inheritence.
> >
>
> To expand on what hemant said.. try running this code.
>
> class Useless
>   def six
>     6
>   end
> end
>
> module AlsoUseless
>   def seven
>     7
>   end
> end
>
> class Thing < Useless
>   include AlsoUseless
>   def five
>     5
>   end
> end
>
> thing = Thing.new
> puts thing.five
> puts thing.six
> puts thing.seven
> puts Thing.ancestors.inspect # Useless and AlsoUseless are shown.

I'm also new to Ruby and I've never used anything with multiple
inheritance. This code is enlightening but I can't see how this is
different from multiple inheritance in practice except that AlsoUseless
is not a class and you don't use the '<' sign with it.

In which cases do the two scenarious (M.I. and mixins) cause different
behaviors? Is it only related to member visibility? If yes, how
exactly?

Thanks!

Helder