This site will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device.
Evaluating the following expression series in the Workspace will create an instance of Painting.
painting1 := Painting new.
painting1 title: 'Iron painting #20';
yearCreated: '1995';
height: 244;
width: 213;
media: 'Polyester resin, fillers, oil and gel on fibreglass;
price: 5000.0
The object painting1 models the painting depicited in this "thumbnail". Click on it to open a larger image in another window.
Mention should be made of the initialize method:
initialize
"Initialize the receiver as for the superclass
then
set framed to false. Answer the receiver."
super initialize
self framed: false
meaning that a new instance of Painting is initialised with its framed instance variable referencing false, a Boolean object, the only instance of the False class. The reasoning behind this is based on a design decision; framed could have been set to true, the only instance of the class True. Booleans will be revisited later.
Here is a variable-reference diagram, which illustrates painting1.
There are several things to note about this diagram.
These diagrams are used to understand assignment. We can now look at a simple problem.
Next page » An assignment exercise
Previous page « Class methods