When Sun was designing Java, it omitted multiple inheritance - or more
precisely multiple implementation inheritance - on purpose. Yet multiple
inheritance can be useful, particularly when the potential ancestors of a
class have orthogonal concerns. This article presents a utility class that
not only allows multiple inheritance to be simulated, but also has other
far-reaching applications.
Have you ever found yourself wanting to write something similar to:
public class Employee extends Person, Employment {
// detail omitted
}
Here, Person is a concrete class that represents a person, while Employment
is another concrete class that represents the details of a person who is
employed. If you could only put them together, you would have everything
necessary to define and implement an Employee class. Except in Java - you
can't. Inheriting implementation from more than one... (more)