Can you re-make a method abstract in the inheritance tree?

后端 未结 4 587
春和景丽
春和景丽 2021-01-25 03:09

EDIT:

To be clear: The fact that the design is quite ugly is not the point. The point is, that the design is there and I am in the situation to have to add another sub-c

4条回答
  •  北海茫月
    2021-01-25 03:36

    Yes, You have to redefine the bar(...) as abstract method. Then you have to declare public class FlyingMotorizedVehicle as a abstract class as well

    public abstract class FlyingMotorizedVehicle extends MotorizedVehicle {
    
        @Override
        SomethingElse doOtherStuff(...) {
            return new SomethingElse();
        }
    
        abstract Foo bar(...);
    
    }
    

提交回复
热议问题