[Reading Notes] iOS-memory release and ios-memory release

Source: Internet
Author: User

[Reading Notes] iOS-memory release and ios-memory release

1. Some programmers prefer to organize the code for memory cleanup in a centralized place in the function, while others prefer to release objects automatically at the creation point to avoid forgetting to release these objects in the future. Both methods are valid.

2. The id type indicates a pointer to any type of object, which is a generic object type. You can assign any object to an id variable or assign an id variable to an object pointer of any type. If a protocol name enclosed in angle brackets follows the id, the compiler will notify you of any type of object as long as it complies with the protocol.

3. Define a formal protocol by listing a set of method names in the @ protocol section. You can use this Protocol to list the Protocol names enclosed by Angle brackets after the class names in the @ interface declaration. When an object adopts a formal protocol, it promises to implement each of the requirements listed in the Protocol. If you do not implement all the methods in the protocol, the compiler will warn you to help you fulfill your promise.

 

References: Objective-C basic tutorial

 

Related Article

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.