I am E-John, a novice of Design Pattern.
I am tracing the Patterns In Action 4.5 WinForms
Some simple questions can not understand,
When "Login" button is pressed, a FormLogin in is created and a LoginPresenter is created.
_loginPresenter = new LoginPresenter(this);
LoginPresenter is inheritanced from Presenter,
LoginPresenter (subclass) -> Presenter (base class)
here the "this" reference is passed to LoginPresenter,
the "this" reference is FormLogin instance here,
Finally the this reference is passed to Presenter(T view)
and view = this is passed to field of Presenter View,
1. Why do we pass the "this" reference to View of Presenter from FormLogin?
2. The parameter of Presenter(T view), T is generic type
The parameter of LoginPresenter is ILoginView, because LoginPresenter : Presenter<ILoginView>
"this" is reference of FormLogin instance,
How is the relations of casting?
Thanks and Best regards,