Class methods and Object methods

Source: Internet
Author: User

Defined:

+ (void) class name: (int) NUM1 and class name: (int// class method -(void) class name: (  int) NUM1 and class name: (int// object Method

Use:

The class method can have the same name as the instance method, does not affect the use, the instance method is called by the instance object access, and the class method accesses the call through the class without cross-interaction.

// class Method [class name Method name]{} // Object Methods [Object Name Method name]{}

New ]; // calling its object method from a CA1 object float result = [CA1 add: andNum2: +]; // calling the class method through the class name result = [Calculator add: andNum2:ten]; NSlog (@ "result =%0.2f", result);

Class methods and Object methods

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.