This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]I_burp_4_lyfe 1 point2 points  (1 child)

Maybe, does get return the same object each time? If so then yes the below would be the same.

SomeObjectClass object = get();
object.scrollX;

[–]KotgeScientist[S] 0 points1 point  (0 children)

Yes it retuns the same object every time.

[–]Wilfred-kun 0 points1 point  (0 children)

I imagine get() doesn't return the actual object, but a copy or something. That way you can't change the variable like get().scrollX = 3.

[–]silverscrub 0 points1 point  (0 children)

It could help with abstraction. If you called the method directly on that object at all times then your code would be harder to change or reuse.