Wednesday, January 28, 2015

"Protocol" on objective c ?

A protocol declares methods that can be implemented by any class. Protocols are not classes themselves. They simply define an interface that other objects are responsible for implementing. Protocols have many advantages. The idea is to provide a way for classes to share the same method and property declarations without inheriting them from a common ancestor.

Types of Protocol
1. Informal -> An informal protocol is a category on NSObject, which implicitly makes almost all objects adopters of the protocol.

2. Formal -> A formal protocol declares a list of methods that client classes are expected to implement. Formal protocols have their own declaration, adoption, and type-checking syntax.

0 comments:

Post a Comment

About

Blog Archive

Powered by Blogger.

Blog Archive