Disabling inherited method on derived class

后端 未结 10 1731
野趣味
野趣味 2020-12-03 06:59

Is there any way to, in a Java derived class, \"disable\" a method and/or field that is otherwise inherited from a base class?

For example, say you have a Shap

10条回答
  •  暖寄归人
    2020-12-03 07:32

    Declaring the same function in the 'child'-class will overwrite the default function declared in the base class. So in your child-class, make a function called rotate() which does nothing, that will overwrite the default behaviour

提交回复
热议问题