I found an explanation What is a covariant return type? but I am no smart to understand it all.
I think Covariant return type theoritically is the type returned by a function that has the same signature with a built-in base class function whose return type is different.
class Base{
TypeX func( int i ){return typex;} // builtin function
};
class Derived:Base{
TypeY func(int i){return typey;}
}
Is my understanding of this so-called covariant return type correct ? [the term really confuses me.]
Unlike java, covariant return types are not supported in C#. I believe this is due to the implementation of C# properties, if covariant return types were allowed, the following would be possible:
See Eric Lippert’s answer for more information.