January 2018
Intermediate to advanced
115 pages
1h 37m
English
A member in a subclass can redefine a member in its superclass. This is most often done to give instance methods new implementations.
In the following example, Rectangle’s getArea method is overridden in Triangle by redeclaring it there with the same method signature. The signature includes the name, parameters, and return type of the method. However, the access level may be changed to allow for more access than the method being overridden: