Protocols are of two types
1.Formal protocol
A formal protocol declares a list of optional and required methods that other classes are expected to implement.
Syntax:
@protocol protocolName
//required method declarations
@optional
//optional method declarations
@required
//other required method declarations
@end
2.Informal Protocol
An informal protocol is a category(with out implementation) on NSObject, which implicitly makes almost all objects adopters of the protocol.Implementation of the methods in an informal protocol are optional.
1.Formal protocol
A formal protocol declares a list of optional and required methods that other classes are expected to implement.
Syntax:
@protocol protocolName
//required method declarations
@optional
//optional method declarations
@required
//other required method declarations
@end
2.Informal Protocol
An informal protocol is a category(with out implementation) on NSObject, which implicitly makes almost all objects adopters of the protocol.Implementation of the methods in an informal protocol are optional.
No comments:
Post a Comment