Methods
We turn our attention now to the syntax used to define methods within
a class. Although the syntax for methods varies widely from language
to language, all methods will have the following features.
- A name. This is the text used to select the method.
- A signature. This is a description that combines the return type
and the argument type. In languages that permit this, multiple methods
with the same name can be distinguised by different signatures.
- A body. This is the code that will be executed when the method
is selected in response to a message.
Now let us see how these parts are expressed in different langauges.