I'm trying to enable a class to inherit all of its data members from other superclasses, but without inheriting unnecessary data members that are only relevant to other classes.
Since I can't inherit from two classes, I figured I'd use interfaces. However, all interface variables are public, static, and final; essentially constants not instance variables.
Any ideas to overcome this problem?
Additional information:
So let's say I need variables x, y, and z to exist in class E.
Variable x will be used by all subclasses of superclass A. Variable y will be used by some subclasses of superclass A. Variable z will also be used by some subclasses of superclass A.
Abstract class B inherits from abstract class A. B contains the variable y. Abstract class C inherits from abstract class A. C contains the variable z. Class D needs variables x and y, it inherits from abstract class B and all is well. Class E needs all the variables x, y, and z. But it cannot inherit from both classes.
How would I get class E to obtain all the variables?