The book has the following code:
origin.x = pt.x;
origin.y = pt.y;
why to copy separately the instance variables instead the whole object like the following?
origin = pt;
try this for yourself and see what happens if you do this. you will see it will have the same issue as program 8.5. the reason you need to assign each variable of origin is so that is gets its own copy of each instance variable of pt, vs setting origin to pt where now it basically references pt and will dynamically change based on pt's attributes being changed..