Override Methods of a Superclass
You can override any method of a parent class by generating necessary code from a predefined template. PyCharm creates a stub that contains a call to the method of the superclass, leaving the developer with the task of providing some meaningful source code in the method's body.
To override a method of a superclass:
On the Generate (Alt+Insert), and select Override methods.menu, click (Ctrl+O). Alternatively, you can right-click anywhere in the class file, then click
- Select the methods to override. The list of methods does not include the methods that are already overridden, or cannot be accessed from the current subclass.
If necessary, select the Copy JavaDoc check box to insert JavaDoc comments for the implemented interface or abstract class.
- Click OK and provide the source code for the method body.
Use the icon that marks the overriding method in the left gutter to view the name of the base class, and to open the overridden method declaration.