What are covariance and contravariance?
This was very interesting.<p>As a mathematician with no comp-sci type knowledge, my only understanding of inheritance is the &quot;is a&quot; rule.  Using this, I realized that a subtype of the set of functions from Dog to Dog must be a set of functions such that each function could be treated as a function from Dog to Dog under an appropriate restriction.  This would be the only way for such a set to satisfy what felt like the &quot;is a&quot; inheritance rule.<p>In other words, a set of functions from A to B where Dog is contained in A and B is contained in Dog would be a subtype of the set of functions from Dog to Dog.  So Animals -&gt; Greyhound works.