In line:
this.Presenter.View = new MyView();
You are trying to set the MyView object to a property of the general type TView (implementation of IView ).
This is not true because MyView is different from TView , so it cannot be assigned.
EDIT:
To expand a bit ...
You can assign a type to your interface, for example.
IView v = new MyView();
but you cannot assign an interface to one of your performers, for example:
IView v = ...; MyView myView = v;
Here you are doing something more confusing, something like this:
IView _______|_______ | | | | TView <-- MyView
This is clearly wrong.
In fact, even if TView and MyView implement the same interface to allow this TView inherit from MyView , but not specified in the general restrictions, and therefore the compiler cannot make any assumptions.
See also davy8 answer for a clear example :)
source share