Some object-oriented languages (such as C++) support multiple inheritance, where a class can have more than one immediate parent,
inheriting functionality from each. Although powerful, this technique can be dangerous, because the inheritance hierarchy can become
Other languages, such as Java and C#, support single inheritance. Here, a class can have only one immediate parent. Although cleaner
(and easier to implement), single inheritance also has drawbacks—in the real world objects often inherit attributes from multiple sources (a
ball is both a bouncing thing and a spherical thing, for example).
Ruby offers an interesting and powerful compromise, giving you the simplicity of single inheritance and the power of multiple inheritance. A
Ruby class has only one direct parent, so Ruby is a single-inheritance language. However, Ruby classes can include the functionality of
any number of mixins (a mixin is like a partial class definition). This provides a controlled multiple-inheritance-like capability with none of