could ildg wrote:

> I heard that ruby only supports single inheritance and it has no
> interface, Is that true? Then what should I do if I really want
> multi-inheritance?

Ruby uses dynamically typed polymorphism, and everything is an object, 
including classes. You can do

Your question matters for a statically typed language, where classes are not 
objects. Such languages need extra stuff to support their behavior.

Java: public void foo(Bar bar) {}

foo is a method that takes a bar of type Bar. We need interfaces to allow 
many things to inherit from Bar and change bar's behavior.

Ruby: def foo(bar)  ;  end

We are not required to declare the type of bar. It can be anything that 
provides methods for the messages foo will send to it.

So you can "inherit interface" simply by making two classes look the same.

Java does not support multiple inheritance of implementation. Ruby does not 
either, but in theory you should need it ;-). In practice, there are several 
cute ways to delegate.

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!