Parameter covariance
|
If a class is inherited and a feature/method/attribute redefined, a parameter or return type can be changed to be a more specialised type.
So if we have a feature A that takes a formal argument T. We redefine A, the new A must have a formal argument of T, or any descendant of T.
Covariant parameters are not safe, but covariant return types are. In Eiffel you can get compiler errors, because the polymorphism breaks.
Return Type Covariance
In Java, return type covariance is implemented.