n179911
n179911

Reputation: 20301

Need help in understand objective c interface declaration

I am new to objective c. I need help in understand the following code:

+@interface MyClassViewController : BaseViewController<SelectionReceiver,SourceState>

Both MyClassViewController and BaseViewController are interface. SelectionReceiver is a protocol SourceState is an interface

What is the meaning of < SelectionReceiver, SourceState>? Is that meaning multiple inheritance? And what is the difference between protocol and interface?

Thank you.

Upvotes: 0

Views: 47

Answers (1)

trimi
trimi

Reputation: 522

Inheritance allows us to define a class in terms of another class which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast implementation time.

A protocol, by contrast, is used to declare methods and properties that are independent of any specific class and are more flexible than a normal class interface

A simple example would be a network URL handling class, it will have a protocol with methods like processCompleted delegate method that intimates the calling class once the network URL fetching operation is over.

Upvotes: 1

Related Questions