"Objective-c study record" fifth day

Source: Internet
Author: User

Self,super

Self is understood as this in C + +, and when the method is called with self, the lookup starts from the current class, and the previous parent class is not searched in turn.

Super is the parent class, and you can call the method of the parent class directly.

+/-

There are public and private methods in OOP, not in OC, but with +/-to represent common and static methods. You can also use @private to represent private variables, and all variables in OC are private by default, and the methods are public.

Deep copy and shallow copy

A shallow copy is to add a pointer to the memory address, a deep copy is to add a pointer and request a new memory. The advantage of deep copy is obvious, the previous way may appear a B pointer pointing to an address, a pointer after the release of B pointer will error, and deep copy will not occur, the disadvantage is memory consumption.

C\c++ and OC Mixing

As long as the CPP file does not contain OC code, it can be used directly with the include import.

Category and Extension

The difference is that the latter can add attributes, and the methods in extension must be implemented.

Objective-c is a dynamic runtime language, because OC does not determine the type of the variable at compile time, but rather at run time.

In OC, the stack memory space is automatically managed by the compiler, and heap memory needs to be managed manually.

"Objective-c study record" fifth day

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.