[mono-devel-list] overriding return type

Alan Jenkins Alan.Jenkins at phonecoop.coop
Mon Jul 28 07:58:47 EDT 2003


Having slept on it, I accept that covariant return types are unnecessary in 
C#.  The technique show in Jacob Egglestons last example (hiding the base 
method using the 'new' modifier in interfaces, and explicitly implementing 
both methods in derived classes) is satisfactory; it probably involves 
writing a few more interfaces and/or methods than you might otherwise; but I 
don't see this as a problem.  Covariant return types may  be desirable in C#, 
but as they are redundant there is little point in departing from the ECMA 
standard - just to scratch an itch.

I think C++ and Java both need covariant return types, but C# is different.  
The difference stems from the 'new' modifier, and the 'Interface.Method' 
syntax for declaring methods.    I didn't grok the implications of these 
features before - I was still thinking as a Java programer.  I've learnt my 
lesson: don't suggest modifications to a language before you understand it.  

I guess thats it then.  Thanks for bearing with me.



More information about the Mono-devel-list mailing list