Objective-C: Inherit

Source: Internet
Author: User

1. In fact, the inheritance in OC is basically the same as that in C #. They all add the: and parent class name when defining the class, that is, myclass: parentclass.

2. Only single inheritance is allowed.

3. It is a bit strange to use attributes. If a property is defined as property1 in the parent parentclass, in implementation of parentclass, you can directly assign values or use attributes by using the name property1. However, in its subclass myclass, you must use the self keyword + dot symbol to use the inherited attributes. However, if the variables are defined in the interface part of parentclass, they can be directly used in the subclass.

 

To be continued

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.