Hi friends ,
Can anybody tell me the difference between formal and informal protocol
I read many articles about protocol and category
what I have understood is
formal protocol declare methods that ca be implemented by any class
(i .e. there are not restricted to any class for implementation and can be implemented by any class ) It will be used to capture similarity among classed which are not hierachically related
Category allows you to add methods to an existing classeven to one to which you do not have the source. they are used to extend the functionality of existing class without sub classing it
but I cant understand the following statements in apples objective c guide
In addition to formal protocols, you can also define an informal protocol by grouping the methods in a
category declaration
Informal protocols are typically declared as categories of the NSObject class, since that broadly associates the method names with any class that inherits from NSObject
protocol and category are different concepts , they have different purpose and different syntax for interface declaration then why informal protocol are categories of NSObject class ?
even if the category is for NSObject class , it should be category not a protocol .....
I am open for suggestion and criticism but please help me to clarify my confusion
Can anybody tell me the difference between formal and informal protocol
I read many articles about protocol and category
what I have understood is
formal protocol declare methods that ca be implemented by any class
(i .e. there are not restricted to any class for implementation and can be implemented by any class ) It will be used to capture similarity among classed which are not hierachically related
Category allows you to add methods to an existing classeven to one to which you do not have the source. they are used to extend the functionality of existing class without sub classing it
but I cant understand the following statements in apples objective c guide
In addition to formal protocols, you can also define an informal protocol by grouping the methods in a
category declaration
Informal protocols are typically declared as categories of the NSObject class, since that broadly associates the method names with any class that inherits from NSObject
protocol and category are different concepts , they have different purpose and different syntax for interface declaration then why informal protocol are categories of NSObject class ?
even if the category is for NSObject class , it should be category not a protocol .....
I am open for suggestion and criticism but please help me to clarify my confusion