oop - get() whats the diff? -
whats difference between these two?
pvector = new pvector(10,12); pvector b = a;
and
pvector = new pvector(10,12); pvector b = a.get();
i realise get() returns re-create of pvector, whats difference other one?
thanks
in first example, b
, a
reference same instance of pvector
. therefore, if alter a.x
or a.y
, alter reflected in b
well.
the sec copies pvector
. changes 1 won't reflected in other they're separate instances of object.
oop processing
No comments:
Post a Comment