I’m studying an example of MVP code, the following looks wrong to me (although it works fine):
On the third line, why isn’t it creating an instance of PuzzlePresenter? I have not seen this syntax before. I would expect something like:
Can you “new” something but it’s not set to anything? Coming from a VB6 background, it just feels wrong to me.
So is it that there is an instance created, but I just don't have a handle to it via a variable?
Is the scope of this instance within the subroutine where it is created?
Code:
PuzzleForm view = new PuzzleForm();
IPuzzleModel model = new PuzzleModel(loadImageModel, imageCutter);
new PuzzlePresenter(model, view);
On the third line, why isn’t it creating an instance of PuzzlePresenter? I have not seen this syntax before. I would expect something like:
Code:
PuzzlePresenter myPresenter = new PuzzlePresenter(model, view);
Can you “new” something but it’s not set to anything? Coming from a VB6 background, it just feels wrong to me.
So is it that there is an instance created, but I just don't have a handle to it via a variable?
Is the scope of this instance within the subroutine where it is created?