Inside the InitializeAndName method, I initially used: return new User(); and my code did not verify. However, after using "return this;", the code verified. What I understand from that is 1. the return new User(); returned a new instance of the User class without any parameters 2. while the "return this;" line returned the newly created instance that contained the arguments passed into the method. I've never seen "this" used in that way so I'm not sure if this is correct.
Task verified BUT I have a question about using "this"
You must be signed in to leave a comment
14 August 2019, 04:54
This means the object that you are in at the moment. When you code somewhere else will call the object, this will be used as the same object.
14 August 2019, 12:54
That makes sense. Thanks.