I have a two abstract classes FlyingBird and RunningBird
public abstract FlyingBird extends Bird implements IFlyingBird {}
public abstract RunningBird extends Bird implements IRunningBird {}
Now I want to have an another abstract class that is both IRunningBird and IFlyingBird
public abstract FlyingRunningBird extends Bird implements IFlyingBird, IRunningBird {}
In this class I am duplicating all the code from FlyingBird and RunningBird
Aggregation of dependent class is not possible as both classes are abstract
The issue is if any bug fix or modification that is done on either FlyingBird or RunningBird will not reflect in FlyingRunningBird. I need to update the FlyingRunningBird too.
Is there any we can avoid this code duplication in FlyingRunningBird? or
Use FlyingBird and RunningBird in FlyingRunningBird to avoid code duplication?
FlyingBirdandRunningBird, it likely belongs to theBirdclass.