The method of OC Basic grammar

Source: Internet
Author: User
See the Code of C # to see Object-c code, always feel a little confused, record the method of OC usage: There are two types of methods in a class in OC: Instance methods (similar to non-static functions), class methods (similar to non-static functions). The instance method preceded by the (-) number indicates that the class method is indicated by (+), as you can see, preceded by a (-) sign, indicating that this is an instance method (the nil keyword equals our null). in OC, invoking a method is equivalent to passing a message, where the message refers to the method name and parameter. the dispatch of all the messages is dynamic, which shows the polymorphism of OC. the message is called by using square brackets. as in the following example, send Insertobject:atindex: This message to the MyArray object.
[MyArray insertobject:anobj Atindex:0];
This message delivery allows nesting
[[Myappobject GetArray] Insertobject:[myappobject Getobjecttoinsert] Atindex:0];

The method of OC Basic grammar

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.