Directives to the compiler begin with “@”. The following directives are used to declare and define classes, categories, and protocols:
Directive | Definition |
|---|---|
Begins the declaration of a class or category interface. | |
Begins the definition of a class or category. | |
Begins the declaration of a formal protocol. | |
Ends the declaration/definition of a class, category, or protocol. |
The following mutually exclusive directives specify the visibility of instance variables:
Directive | Definition |
|---|---|
Limits the scope of an instance variable to the class that declares it. | |
Limits instance variable scope to declaring and inheriting classes. | |
The default is @protected.
These directives support exception handling:
Directive | Definition |
|---|---|
Defines a block within which exceptions can be thrown. | |
Throws an exception object. | |
Catches an exception thrown within the preceding | |
Defines a block of code that is executed whether exceptions were thrown or not in a preceding |
In addition, there are directives for these particular purposes:
Directive | Definition |
|---|---|
Declares the names of classes defined elsewhere. | |
Returns the compiled selector that identifies method_name. | |
Returns the protocol_name protocol (an instance of the Protocol class). ( | |
Yields a character string that encodes the type structure of type_spec. | |
Defines a constant | |
Defines a constant | |
Defines a block of code that must be executed only by one thread at a time. |
Last updated: 2008-02-05