The Objective-C Programming Language by Apple Inc

The Objective-C Programming Language by Apple Inc

Author:Apple Inc.
Language: eng
Format: epub, pdf
Publisher: www.apple.com


Protocols

Protocols declare methods that can be implemented by any class. Protocols are useful in at least three situations:

To declare methods that others are expected to implement

To declare the interface to an object while concealing its class

To capture similarities among classes that are not hierarchically related

Declaring Interfaces for Others to Implement

Class and category interfaces declare methods that are associated with a particular class—mainly methods that the class implements. Informal and formal protocols, on the other hand, declare methods that are independent of any specific class, but which any class, and perhaps many classes, might implement.

A protocol is simply a list of method declarations, unattached to a class definition. For example, these methods that report user actions on the mouse could be gathered into a protocol:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.