March 2018
Intermediate to advanced
183 pages
2h 34m
English
A new method in a derived class can redefine a method in a base class in order to give it a new implementation.
In the following example, Rectangle’s getArea method is redeclared in Triangle with the same signature. The signature includes the name, parameter list, and return type of the method.
If a Triangle object is created and the getArea method is invoked, then Triangle’s ...