Well, there is inheritance (keyword extends) but I think that a class
can extend only 1 class (which can extend another but not two "at the
same time")... but I'm not sure so you can check...
john ha scritto:
> Hello,
>
[quoted text clipped - 14 lines]
> Thanks,
> John.
Matt Humphrey - 09 Jun 2005 11:33 GMT
> Well, there is inheritance (keyword extends) but I think that a class
> can extend only 1 class (which can extend another but not two "at the
[quoted text clipped - 16 lines]
> > Using interfaces requires to re-implement functions in FormView which
> > are already implemented in class Window or in class View.
There is no automatic way in Java to inherit functionality directly from
more than one classe. Java multiple inheritance is via interfaces, so you
can make you class inherit from multiple interfaces. You don't necessarily
have to reimplement the functionality because your new class can still be a
composition of the other classes. Your class must simply redirect to the
compositions.
interface IView
class View implments IView
interface IWindow
class Window implements IWindow
class Form implements IView, IWindow {
View view, Window window;
methods for IView, IWindow are redirected to the components
}
Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Pehaps you may consider creating an instance variable of the 'other' class.
This approach is preferred in many cases. Composition is a good alternative
to multiple inheritance, and is preferred by some authors of the subject.
HTH
> Hello,
>
[quoted text clipped - 14 lines]
> Thanks,
> John.