Multiple Inheritance in Ruby?

inheritance, ruby

Solution

I think you are taking the meaning of multiple inheritance in a wrong way. Probably what you have in mind as multiple inheritance is like this:

class A inherits class B
class B inherits class C

If so, then that is wrong. That is not what multiple inheritance is, and Ruby has no problem with that. What multiple inheritance really means is this:

class A inherits class B
class A inherits class C

And you surely cannot do this in Ruby.

Problem

I thought that Ruby only allowed single inheritance besides mixin. However, when I have class `Square` that inherits class `Thing`, `Thing` in turn inherits `Object` by default. ``` class Thing end class Square < Thing end ``` Doesn't this represent multiple inheritance?

Original source

Related problems