Week12 - Interfaces and Polymorphism FL24 2
Week12 - Interfaces and Polymorphism FL24 2
1
Lecture Goals
Same algorithm of
computing average but
with different
measurements
Remember all of
type Object
Use getMeasure()
Figure 1 UML Diagram of the Data Class and the Classes that Implement the
Measurable Interface
Data class
In the UML is decoupled
notation, (separated
interfaces are tagged ) from
with an indicator the
«interface». A dotted
BankAccount and
arrow with a triangular tip ( Country
) denotesclasses.
the implements relationship between a class
and an interface. You have to look carefully at the arrow tips—a dotted line with an
open arrow tip ( ) denotes the uses relationship or dependency.
Solution: cast
Country maxCountry = (Country) max;
String name = maxCountry.getName();