{"id":1209,"date":"2020-04-15T18:21:15","date_gmt":"2020-04-15T06:21:15","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1209"},"modified":"2020-04-15T18:21:15","modified_gmt":"2020-04-15T06:21:15","slug":"covariant-vs-contravariant","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1209","title":{"rendered":"Covariant vs Contravariant"},"content":{"rendered":"<h1>Covariant<\/h1>\n<p>The type can vary in the direction as the subclass.<\/p>\n<h1>Contravariant<\/h1>\n<p>The reverse of covariant.<\/p>\n<h1>Example in Generics<\/h1>\n<table>\n<tbody>\n<tr>\n<td><strong>Language<\/strong><\/td>\n<td><strong>Covariant<\/strong><\/td>\n<td><strong>Contravariant<\/strong><\/td>\n<\/tr>\n<tr>\n<td>C#<\/td>\n<td>IList&lt;out T&gt;<\/td>\n<td>IList&lt;in T&gt;<\/td>\n<\/tr>\n<tr>\n<td>Java<\/td>\n<td>List&lt;? extends Number&gt;<\/td>\n<td>List&lt;? super Integer&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Covariant The type can vary in the direction as the subclass. Contravariant The reverse of covariant. Example in Generics Language Covariant Contravariant C# IList&lt;out T&gt; IList&lt;in T&gt; Java List&lt;? extends Number&gt; List&lt;? super Integer&gt;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[60],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1209"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1209"}],"version-history":[{"count":1,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1209\/revisions"}],"predecessor-version":[{"id":1210,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1209\/revisions\/1210"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}