Send, self and super are used to call
methods in classes and instances.
send can call methods from any class or
instance.
self calls methods from it's own class
or instance's method.
super calls methods from it's superclass.
syntax
(send <ClassName>:
<MethodName>([params])
...
)
Example - Result
will equal 40 |
//
you can access classes like this...
(ClassX:
init()
doit()
)
//
you can call it directly...
(SomeInstance:foo())
//
or indirectly...
= InstancePtr SomeInstance
(send InstancePtr:foo())
//
or a shortcut to the indirect way...
(send (=
InstancePtr SomeInstance):foo())
(self:init())
(super:doit())
|
|