A Tshirt Class
As another example of a user-defined class, look at the Tshirt
class in the Tshirt demo
It is similar to BBall in important (and trivial) ways:
- It draws an object composed of six subpieces.
- Its constructor creates all the subpieces and associates names
with them.
- Its move method moves them all.
- Its moveTo method depends on its move method.
There are also a few interesting differences:
- Its contains method can not just call the
contains method of one other object.
- It has some extra
methods (setColor, sendToFront).