Adding Shapes to a Playground
A number of additional classes, representing a variety of shapes, were also added as part of the Playground package. The ones we're interested in at the moment are Triangle, Square and Circle. Let's add one of each of these types of object to our current Playground:
teresa := playground add: Triangle new.
simon := playground add: Square new.
charlie := playground add: Circle new.
Once again, we create an object of a class (Triangle, Square, Circle etc.) by sending #new to the class. As each new shape object is created, we add it to the Playground by passing it as a parameter to an #add: message. We assign the shapes to some friendly variables so that we can "talk" to them later.
Tip: you may remember from the previous chapter that it is a convention that an #add: message will always return the object that is added as its answer.
So now we have workspace variables identifying:
"Teresa the Triangle"
"Simon the Square" and
"Charlie the Circle"