From: Peter Hickman Date: 2012-11-04T23:49:49+09:00 Subject: Re: Support for multiple Inheritance by classes --14dae9399d73f9ce2004cdac7a92 Content-Type: text/plain; charset=ISO-8859-1 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. 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. 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. --14dae9399d73f9ce2004cdac7a92 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Ok then lets return to your puzzle problem. Given the first example that do= esn't work.=A0Well done you wrote some code that is invalid Ruby, guess= what, you can do that in any language even if it has multiple inheritance.=

Now your second example, why did you write it that way? Ther= e 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 c= ode that works the same, it is written as any Ruby programmer would write i= t.

module StableModuleA
= =A0 puts :A
end

module StableModuleB
=A0 puts :B
end

class Inheritor
=A0 include StableModuleA
=A0 include Sta= bleModuleB
= =A0 puts :I
end
<= /div>

<= div>Notice how it looks like the first (broken) example but with modules no= t classes. Notice also how it actually works.

Can you now explain what advantages multiple inheritanc= e is supposed to have over the code given here?

Th= is is why puzzle problems suck. Just give a real problem that is better sol= ved by multiple inheritance and you will have proven your point.

--14dae9399d73f9ce2004cdac7a92--