Instance Method References
Description
We can get an instance method reference in two ways, from the object instance or from the class name.
Basically we have the following two forms.
- instance::MethodName
- ClassName::MethodName
Here the instance
represents any object instance.
ClassName
is the name of the
class, such as String
, Integer
.
instance
and ClassName
are called the receiver.
More specifically, instance
is called bounded receiver while
ClassName
is called unbounded receiver.
We call instance
bounded receiver since the receiver is bounded to
the instance.
ClassName
is unbouned receiver since the receiver is bounded later.