Objective-C inheritance

Source: Internet
Author: User

1. Inheritance mainly reflects the relationship between classes. Using inheritance can reduce repeatedCode.

 

2. Inheritance Mechanism Method lookup: If a message is sent to an object, the schedulingProgramFind the method corresponding to the message in this object. If the Scheduler cannot find the object, it will go to the super class to find it. If no more information is found, follow the inheritance chain to find the corresponding method of the message. If not found, a compile-time warning and a running error will appear.

 

3. The objective-C instance variable corresponds to the data member of C. The instance variables of the class and the code are stored in different locations. Therefore, if there is a hidden parameter self pointing to the instance variables.

 

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.