Operations
An operation is something a class can do, and hence it is something that you (or another class) can ask the class to do. Like an attribute name, an operation's name is all in lowercase if it's one word. If the name consists of more than one word, join the words and begin all words after the first with an uppercase letter. The list of operations begins below a line that separates the operations from the attributes, as in Figure 3.7.
Figure 3.7 The list of a class's operations appears below a line that separates them from the class's attributes.
Just as you can indicate additional information for attributes, you can indicate additional information for operations. In the parentheses that follow an operation name, you can show the parameter that the operation works on, along with that parameter's type. One kind of operation, the function, returns a value after it finishes doing its work. For a function, you can show the value it returns and that value's type.
These pieces of information about an operation are called the operation's signature. Figure 3.8 shows a couple of ways to represent the signature. The first two operations show the type of the parameter. The third and fourth show the type of the return value.
Figure 3.8 Signatures for operations.