From: Helder Ribeiro Date: 2007-01-12T09:40:10+09:00 Subject: Re: inheritance concept in ruby Wilson Bilkovich wrote: > On 1/9/07, Kumar Tnj 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