I'm working with a certain API library in Java. It has a base class A, as well as B and C which both extend A. B & C provide similar but distinct functionality, all three classes are in the library.
public abstract class A
{
virtual foo();
}
public class B extends A {}
public class C extends A {}
How do I get elements of A
, B
, and C
in my class? If I use interfaces to implement the classes, there is a lot of duplicate code, and inner classes will not allow me to override existing methods so that the calling interfaces of A
, B
, and C
are preserved.
How do I implement multiple inheritence in Java?
EDIT: Thanks for edit George, its more clear now, forgot to mention one critical requirement: my classes must have A as a base so that they can be managed by platform API.