Go to the first, previous, next, last section, table of contents.


Method definitions

method_definition:
          [`extern'] method_declaration
        | shared_method_part method_body
        ;

The first case is a valid definition if extern is given, which indicates that the actual implementation of this method is written in another language, or if the method_declaration includes a redeclare qualifier.

Every identifier in an argument_name in the shared_method_part introduces in the body of the method a local variable by that name, with the type as indicated in the declarations, which will be initialized to the actual value passed to an invocation of the method.

Every method has two implicit first arguments. First, there is self, the type of which is, by definition, id (see section The id type). The second argument is the selector cmd, which is the selector that was used to invoke the current method. cmd isn't actually used in most method implementations; its precense is, however, an elementary part of the dynamic method binding and method forwarding mechanisms.

method_body:
          compound_expression
        ;


Go to the first, previous, next, last section, table of contents.