2019-08-02 13:25:00

hello!
As in questin, how can I return an object from a method? Lets say I have created a UserInfo class, I am connecting to the HTTP server in a method and doing my magic from there, now I want to return the UserInfo object from the method.
What should I do to achieve this?

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-08-02 15:13:56

Try
this.
You'd return it like you would any other return value. Note that when you return an object, you return its reference and not the object itself. In other words, if you pass an object's reference variable to another method that operates on that object, it has access to its methods and attributes. You need to perform what is called a "deep copy" and copy the object and return that from your method. Passing by reference is called a "shallow copy."

What game will hadi.gsf want to play next?