• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Understanding the docs. UIApplication for iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Understanding the docs. UIApplication for iOS


  • Subject: Re: Understanding the docs. UIApplication for iOS
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 04 Jun 2013 11:16:31 -0700


On Jun 4, 2013, at 10:44 AM, Fritz Anderson <email@hidden> wrote:

What makes a protocol different is that a class can make a promise to implement a certain API; and a parameter (or whatever) can demand that API without having to specify a particular class. The compiler enforces the promise and the compatibility as best it can.

It’s exactly like an ‘interface’ in Java (and a lot of other languages have identical concepts.) It lets a class inherit an API but not implementation. It’s a less complex alternative to multiple inheritance — you can inherit from multiple things, but only one of them can have an implementation, so you don’t get the awful problems you find in C++ when multiple base classes implement the same method.

If you aren’t familiar with Java interfaces, then think of a protocol as a special kind of class that doesn’t implement any of its methods, so you have to implement/override them all. But in exchange a class gets to inherit from multiple protocols in addition to a base class.

—Jens
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Understanding the docs. UIApplication for iOS (From: gweston <email@hidden>)
 >Re: Understanding the docs. UIApplication for iOS (From: Alex Zavatone <email@hidden>)
 >Re: Understanding the docs. UIApplication for iOS (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Understanding the docs. UIApplication for iOS
  • Next by Date: Re: Understanding the docs. UIApplication for iOS
  • Previous by thread: Re: Understanding the docs. UIApplication for iOS
  • Next by thread: Re: Understanding the docs. UIApplication for iOS
  • Index(es):
    • Date
    • Thread