Objective C Protocol


“A strategy is simply a collection of strategy conditions, separate to a training description. (In Coffee, program is symbolic of strategy.)”

Protocols assert techniques that can be integrated by any training. Methods are useful in at least three situations:

    To assert techniques that others are required to implement
    To assert the program to an item while covering its class
    To take parallels among sessions that are not hierarchically related

Classes in not relevant offices of the monetary gift structure might be searched as well because they comply with the same strategy.

Protocols collection techniques that are (or may be) integrated somewhere, but the personality of the training that tools them is not of attention. What is of attention is whether or not a particular training shapes to the protocol—whether it has implementations of the techniques the strategy reports. Thus items can be arranged into kinds not just on the foundation parallels as a result of getting from the same training, but also on the foundation their likeness in contouring to the same strategy.

Cocoa has relaxed protocols as well as proper protocols. An relaxed strategy is a classification on the NSObject training, thus making any item a prospective implementer of any strategy in the classification (see “Categories”). The techniques in an relaxed strategy can be precisely integrated. Informal protocols are part of the rendering of the delegation process in Mac OS X (see “Delegation”).

Formal protocols unconditionally need the contouring training to put into practice all announced techniques. However, they can level individual techniques or categories of techniques with the @optional information, and the contouring training may choose to put into practice those. They are also fragile; once you determine a strategy and make it available to other sessions, upcoming changes to it (except for extra optionally available methods) can separate those sessions.e

0 comments:

Post a Comment

Powered by Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More