blob: b806b5013d27ce64eb601443c67361096f010c8e [file] [log] [blame]
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "../xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../css/ot.css" />
<link rel="stylesheet" type="text/css" href="../css/otjld.css" />
<title>OT/J Language Definition v1.3.1</title>
</head>
<body class="otdt">
<div id="content">
<table class="nav">
<tr>
<td class="back"><a id="top"></a><a href="s4.9.3.a.html" rel="prev">&lt;&lt;&nbsp;&sect;4.9.3.(a)&nbsp;No covariant callin methods</a></td>
<td class="top"><a href="index.html" rel="contents">&uarr;&nbsp;Table of Contents&nbsp;&uarr;</a></td>
<td class="next"><a href="s4.9.3.c.html" rel="next">&sect;4.9.3.(c)&nbsp;Covariant replace binding&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s4.html" rel="section">&sect;4&nbsp;Callin Binding</a>&nbsp;&gt;&nbsp;<a class="nav" href="s4.9.html" rel="section">&sect;4.9&nbsp;Callin inheritance</a>&nbsp;&gt;&nbsp;<a class="nav" href="s4.9.3.html" rel="section">&sect;4.9.3&nbsp;Covariant return types</a></div>
<div class="subsect depth4" id="s4.9.3.b">
<h4 class="subsect">&sect;4.9.3.(b)&nbsp;<span class="title">Capturing covariant base methods</span><a class="img" href="s4.9.3.b.html"
title="PermaLink to (b)&nbsp;Capturing covariant base methods"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>
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
</p>
<div class="listing plain"><pre><b>void</b> rm() <b>&lt;-</b> <b>before</b> <em>RT+</em> bm();</pre></div>
<p>Without the "+" sign the binding would only capture base methods whose
return type is exactly <code>RT</code>;
by appending "+" also sub-types of <code>RT</code>
are accepted as the declared return type.
</p>
</div>
<table class="nav">
<tr>
<td class="back"><a href="s4.9.3.a.html" rel="prev">&lt;&lt;&nbsp;&sect;4.9.3.(a)&nbsp;No covariant callin methods</a></td>
<td class="top"><a href="index.html" rel="contents">&uarr;&nbsp;Table of Contents&nbsp;&uarr;</a></td>
<td class="next"><a href="s4.9.3.c.html" rel="next">&sect;4.9.3.(c)&nbsp;Covariant replace binding&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s4.html" rel="section">&sect;4&nbsp;Callin Binding</a>&nbsp;&gt;&nbsp;<a class="nav" href="s4.9.html" rel="section">&sect;4.9&nbsp;Callin inheritance</a>&nbsp;&gt;&nbsp;<a class="nav" href="s4.9.3.html" rel="section">&sect;4.9.3&nbsp;Covariant return types</a></div>
</div>
<div id="footer">
<hr /><a class="w3c img" href="http://jigsaw.w3.org/css-validator/check/referer"
shape="rect"><img src="../images/valid-css2-blue.png" alt="Valid CSS!" height="31" width="88" /></a><a class="w3c img" href="http://validator.w3.org/check?uri=referer" shape="rect"><img src="../images/valid-xhtml10-blue.png" alt="Valid XHTML 1.0 Strict" height="31"
width="88" /></a><address>&copy; Stephan Herrmann, Christine Hundt, Marco Mosconi</address>
OT/J version 1.3.1 &mdash; last modified: 2013-05-28
</div>
</body>
</html>