<p>I originally asked <a href="https://stackoverflow.com/questions/46933/why-doesnt-inheritance-work-the-way-i-think-it-should-work">this question</a>, but in finding an answer, discovered that my original problem was a lack of support in C# for covariance on inherited methods' return types. After discovering that, I became curious as to what languages <em>do</em> support this feature.</p>

<p>I will accept the answer of whoever can name the most.</p>

<p><strong>EDIT</strong>: John Millikin correctly pointed out that lots of dynamic languages support this. To clarify: </p>

<p><strong>I am only looking for static/strongly typed languages.</strong></p>

[{'answer_id': 47018, 'author': 'John Millikin', 'author_id': 3560, 'author_profile': 'https://Stackoverflow.com/users/3560', 'pm_score': 2, 'selected': False, 'text': '<p>Any dynamic languages, of course -- Python, Ruby, Smalltalk, Javascript, etc.</p>\n'}, {'answer_id': 47038, 'author': 'John Millikin', 'author_id': 3560, 'author_profile': 'https://Stackoverflow.com/users/3560', 'pm_score': -1, 'selected': False, 'text': "<blockquote>\n  <p>but I think thats what I'm asking for..or is it?</p>\n</blockquote>\n\n<p>I frankly don't know what you're asking. Java apparently has the same support for return-type covariance as C#, so if whatever you're looking for is lacking in C#, it's lacking in Java also.</p>\n"}, {'answer_id': 47053, 'author': 'John Millikin', 'author_id': 3560, 'author_profile': 'https://Stackoverflow.com/users/3560', 'pm_score': 0, 'selected': False, 'text': "<blockquote>\n  <p>Basically what I'm asking is what languages support what I'm trying to do here.</p>\n</blockquote>\n\n<p>Does C# let you specify different data types for the <code>get()</code> and <code>set()</code> methods? If not, I would split them into actual <code>Leg get_leg()</code> and <code>set_leg(DogLeg)</code> functions. Otherwise one of two things will happen: 1) overspecification of <code>get_leg()</code> 2) underspecification of <code>set_leg()</code>.</p>\n"}, {'answer_id': 47061, 'author': 'Mat Noguchi', 'author_id': 1799, 'author_profile': 'https://Stackoverflow.com/users/1799', 'pm_score': 0, 'selected': False, 'text': '<p>C++ supports covariant return types.</p>\n'}, {'answer_id': 47306, 'author': 'Ivan Hamilton', 'author_id': 4729, 'author_profile': 'https://Stackoverflow.com/users/4729', 'pm_score': 4, 'selected': True, 'text': '<ul>\n<li>C++</li>\n<li>Java</li>\n<li>REALbasic</li>\n<li>Eiffel</li>\n<li>Sather</li>\n<li>Modula-3</li>\n</ul>\n'}, {'answer_id': 49577, 'author': 'John Meagher', 'author_id': 3535, 'author_profile': 'https://Stackoverflow.com/users/3535', 'pm_score': 0, 'selected': False, 'text': '<p>Java added support for this in 1.5.  It will not compile in earlier versions.  </p>\n'}, {'answer_id': 70491, 'author': 'mlbrock', 'author_id': 9966, 'author_profile': 'https://Stackoverflow.com/users/9966', 'pm_score': 0, 'selected': False, 'text': '<p>As pointed out by Ivan Hamilton and Mat Noguchi, C++ supports the feature. But note that covariant return types are broken for template classes which inherit from some base in MSVC 7.X through 9.X (and probably 6 also). You get error C2555.</p>\n'}]
['https://Stackoverflow.com/questions/47009', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/327/']