|
Examples of slotsThe figure shows a bank account object. It has three slots, named balance, deposit: and withdraw:. Balance is an assignable slot which currently contains 100, whereas deposit: and withdraw: contain methods. Deposit: takes its argument and adds it to the balance. Withdraw: subtracts its argument from the balance, but ensures that the balance does not go below zero. In the graphical representation of the object, we can distinguish method slots from data slots, and constant slots from assignable slots, by the icon in the button at the right hand of the slot.
To the left of each button appears a piece of text (in italics) which describes what's in the slot. Sometimes there is insufficient room for a complete description; then, an ellipsis (...) will appear. Left-clicking the button always tells you the whole story by opening a method editor or summoning the object. You can hide or expose the slots in an object by clicking on the triangle at the top left of the object; this cause the view to collapse if it was expanded or expand if it was collapsed.
|