title: Runtime determination of base class at runtime in Java
body: <p>I have two classes, one which is hardware-dependent and one which is not (let's call them HardwareDependent and HardwareIndependent respectively).  The Hardware dependent class extends the hardware independent class.  Now I have another class which at least must be an extension of the HardwareIndependent, but I would prefer it to be an extension of HardwareDependent when possible so it may leverage the additional functionality.  Is there a possibility of using reflection or something else to accomplish this?  Or is this a total technical impossibility?  I suppose if all else fails, I could write the class twice, but it seems to me that is an ineffective approach.  Thanks for any help in advance.</p>