Anonymous
Unregistered
|
|
Why, oh why did the author need to get bogged down in discussing Swing, drag-n-drop and Servlets? The so-called "technique" could have and should have been presented without the distraction of an underlying, unrelated "system".
The author is correct in that the technique is not true multiple inheritance. I would say it's not even simulated multiple inheritance since instances of SendMessageServlet are not instances of MessageClient.
At any rate, JavaWorld is just as guilty for letting this article appear on its site. This used to be the premier site for Java technical information. Now it's a garbage bin.
|
fire
Unregistered
|
|
This technique is widely discussed, e.g. in Thinking in Java as a work-around for the case that you want to add extra behaviours from some interfaces/classes to an existing class, whose superclass cannot be changed.
For beginners (or even programmers with experiences of a few years) it is still a good lesson. Don't be too critical, ;-)
|
Anonymous
Unregistered
|
|
I must say that I agree with the first post (the anonymous) one, for "Needless fluff". First the author of the article starts by saying that we will see "multiple" inheritance with a Swing example, which should have something easy to digest, but then it jumps to a much more complicated example. To say the least, this is confusing. Moreover the example provided doesn't make a clear statement why multiple inheritance is required in this case (not to mention that, as the first poster said, the example provided doesn't simulate the MI too much). In my opinion this trick, with using inner classes, is just a simple variation for the solution provided by most Java books when it comes to multiple inheritance: use a local reference to the other class, and let delegation do the magic.
|
mastermind
stranger
Reged: 07/15/05
Posts: 1
|
|
very true...
|