<< §4.9.3.(a) No covariant callin methods | ↑ Table of Contents ↑ | §4.9.3.(c) Covariant replace binding >> |
§4.9.3.(b) Capturing covariant base methods
If a callin binding should indeed affect not only the specified base method but also overriding versions which covariantly redefine the return type, the binding must specify the base method's return type with a "+" appended to the type name as in
void rm() <- before RT+ bm();
Without the "+" sign the binding would only capture base methods whose
return type is exactly RT
;
by appending "+" also sub-types of RT
are accepted as the declared return type.
<< §4.9.3.(a) No covariant callin methods | ↑ Table of Contents ↑ | §4.9.3.(c) Covariant replace binding >> |