<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Polymorphism (computer science) - Page 16 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=Polymorphism_(computer_science)&amp;p=15">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Polymorphism_%28computer_science%29&amp;p=17">3.Next</a>
</p>
<p>void main(String[] args) {    letsHear(new Cat());    letsHear(new Dog());}</p>

<p>In another example, if Number, Rational, and Integer are types such that ''Number'' :> ''Rational'' and ''Number'' :> ''Integer'' (Rational and Integer as subtypes of a type Number that is a supertype of them), a function written to take a Number will work equally well when passed an Integer or Rational as when passed a Number. The actual type of the object can be hidden from clients into a <a href="page.php?w=black_box">black box</a>, and accessed via object</p><p>
<a accesskey="1" href="page.php?w=Polymorphism_(computer_science)&amp;p=15">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Polymorphism_%28computer_science%29&amp;p=17">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
