Informal Protocols

You might come across the notion of an informal protocol in your readings. This is really a category that lists a group of methods but does not implement them. Everyone (or just about everyone) inherits from the same root object, so informal categories are often defined for the root class. Sometimes informal protocols are also referred to as abstract protocols.

If you look at the header file <NSScriptWhoseTests.h>, you might find some method declarations that look like this:

@interface NSObject (NSComparisonMethods)- (BOOL)isEqualTo:(id)object;- (BOOL)isLessThanOrEqualTo:(id)object;- (BOOL)isLessThan:(id)object;- (BOOL)isGreaterThanOrEqualTo:(id)object;- (BOOL)isGreaterThan:(id)object;- (BOOL)isNotEqualTo:(id)object; ...

Get Programming in Objective-C, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.