Informal agreements and formal agreements in the OBJECT-C

Source: Internet
Author: User

Before the term "informal agreement" is not very understanding, after reviewing the understanding of their own simple comb,

Here is an introduction to the informal agreement in Apple's official document Cocoa Core competencies:

An informal protocol are a category on NSObject , which implicitly makes almost all objects adopters of the protocol. (A category is a language feature this enables you to add methods to A class without subclassing it.) Implementation of the methods in a informal protocol is optional. Before invoking a method, the calling object checks to see whether the target object implements it. Until Optional Protocol methods were introduced in OBJECTIVE-C 2.0, informal protocols were essential to the the-to-the-the-the-the-the- N and AppKit classes implemented delegation.

We can see that the informal agreement is the categorythat we commonly use, and the formal agreement is a list of methods that are named in @protocol way, and unlike the informal agreement, it requires a display of compliance agreements.

Informal agreements and formal agreements in the OBJECT-C

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.