![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
You have seen examples of three kinds of methods:
Methods such as sqrt
are said to be unary methods, because
they appear in messages that have no arguments. Thus, unary methods focus
entirely on one object: the receiver.
Methods such as raisedTo:
are said to be keyword methods,
because their selectors include colons, which indicate that arguments are
expected. The raisedTo: method happens to work on two objectsthe
receiver and the argumentbut you will see (in Segmentmissing reference, for example)
that some keyword methods are meant to work on multiple arguments.
Like keyword methods, methods such as * appear in expressions with arguments, but because their selectors include no colons, they are not keyword methods. Instead, their selectors consist of one or two special characters, most of which denote common arithmetic operations. Collectively, these methods are said to be binary methods, because they bring exactly two objects together: the receiver and one argument.