To use covariance/contravariance, I need to use generic with either interface or delegate. I assume that it has to do something with the language design problem.
For example, this shows me no problem, but gives me compile errors : There are no qualified methods overridable(basically).
class Human
{
public virtual void f(String i) { } // I want Contravariance
public virtual Object f2() { } // I want Covaraicne
}
class Mike : Human
{
public override void f(Object o) { } // Fail.
public override String f2() { } // Fail
}
I assume that It would be cool if we can do that as well, but unfortunately there are some hidden problems to initialize it in the compiler or something.
I'm google-ing for articles which can give me the good answer to this so any links will be appreciated as well.
Thanks in advance.