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
I needed the same thing for a custom alertdialog. I needed to pass an argument that became available only at the show moment, so I implemented my show(argument) method, but show() worked too because of the superclass. There was a risk of that I could invoke myDlg.show()
by accident, without an argument, and that would cause a crash. To make sure the superclass method is never called outside my CustomAlertDialog class, I added the method private static void show(){}
to it. That's it.
So, to disable a supermethod, make it private and static in the subclass. In your case, it would be:
private void rotate(){}