http://citeseer.nj.nec.com/viega98automated.html
"Automating delegation, in combination with a multiple subtyping mechanism, provides many of the same benefits as multiple inheritance, yet sidesteps most of the associated problems.
...In this paper, we discuss why automated delegation is desirable. We also present Jamie, a freeware preprocessor-based extension to Java that offers such an
alternative."
The authors add a new construct to the language:
public class A forwards SomeInterface to delegate implements SomeInterface {
protected SomeInterface delegate;
}
A is now a subtype of SomeInterface, but calls to SomeInterface's methods are "routed" to the delegate (by generated wrapper scripts, I think). This means you can inherit functionality from multiple classes.
|