OBJECTIVE-C program structure and grammatical features

Source: Internet
Author: User

  • The program files are divided into header files (. h) and implementation files (. m);
  • Use the #import keyword to import the desired header file into the program, and you can avoid the program repeatedly referencing the same header file;
  • @autoreleasepool {...} to release the pool automatically;
  • Symbol "@" is widely used, reflecting the new characteristics of objective-c;
  • Print output using NSLog execution Console (for example: NSLog (@ "Hello world!") );
  • With Objective-c own Boolean type--bool, the value is: yes/no;
  • The ID data type, the generic object pointer, can represent any object type;
  • Use nil to denote empty objects;

  Summarize:

1. The key words in OC begin with @.

2, the beginning of the program, C is the #include<.h> OC is the #import<.h>; #import比 # # # # # # # # # # It's good to see if the header file has been imported before importing the header file, and if not, import the header file. If you have already imported it, you are no longer repeating the import header file.

3. @interface representative declares a class;: (colon) represents inheritance

4, NSString function: 1, inform its length; 2, compare itself with other strings, 3, convert itself to an shaping value or a floating point value.

5.Nil represents an empty object,null represents a null pointer,nil represents an empty class, andNSNull represents an empty object in the OC collection.

6. The default value for char type is-0

OBJECTIVE-C program structure and grammatical features

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.