Parameters vs. Instance VariablesTopA Tshirt ClassDragging Tshirts

Dragging Tshirts

A further example using the Tshirt class is in Drag2Shirts,

The two shirt dragging program is interesting, however, especially because it is a bit like your next lab program.... Your own program will be much, much easier if you emulate the way we switch the names of the shirts so that selectedShirt is always the shirt being dragged, while otherShirt is the one not being dragged.

Make sure you understand this code, and especially the role of tempShirt in swapping their names.


Parameters vs. Instance VariablesTopA Tshirt ClassDragging Tshirts