From: Ross Konsolebox Date: 2012-11-04T23:57:02+09:00 Subject: Re: Support for multiple Inheritance by classes Peter Hickman wrote in post #1082761: > Ok then lets return to your puzzle problem. Given the first example that > doesn't work. Well done you wrote some code that is invalid Ruby, guess > what, you can do that in any language even if it has multiple > inheritance. Yeah I noticed that I didn't place them in methods and directly used puts instructions. It's pretty obvious. So what about it? > Now your second example, why did you write it that way? There is no need > for StableClassA or StableClassB. Throw them away and nothing changes as > Inheritor does not inherit from either of them. Here's the code that > works > the same, it is written as any Ruby programmer would write it. Sigh. I was hoping you had understand the essence of this post already. StableClassA and StableClassB is meant to be used as standalone and working classes as well. They're not just inherited as virtual, abstract or incomplete classes. > module StableModuleA > puts :A > end > > module StableModuleB > puts :B > end > > class Inheritor > include StableModuleA > include StableModuleB > puts :I > end > > Notice how it looks like the first (broken) example but with modules not > classes. Notice also how it actually works. > > Can you now explain what advantages multiple inheritance is supposed to > have over the code given here? > > This is why puzzle problems suck. Just give a real problem that is > better > solved by multiple inheritance and you will have proven your point. Try to reconsider things again from my reply which is meant to be obvious actually. Turns out you really don't have the idea. I'm guessing we'll be going through the details bit by bit before you fully understand what I mean. -- Posted via http://www.ruby-forum.com/.