I have a homework question which confused me, really badly. Below is a brief explanation of a question.
Imagine you are developing an application that
A protocol is the same thing as a Java interface. It just defines which methods the class should support. Here's a page that explains it clearly: http://www.otierney.net/objective-c.html#protocols
Essentially if you want to make sure a class will have a phoneNumber method (accessor to the phoneNumber property) you would do something like this:
@protocol ContactProtocol
-(void) phoneNumber;
@end
@interface Person: NSObject {
...
}
@interface Company: NSObject {
...
}
And then at compile time (or live for xcode 4) it will tell you if you forgot to add the phoneNumber method to the Person or Company classes.