Departure, inheritance of C

Source: Internet
Author: User
Cocoa and object-c are at the heart of Apple OS X and iOS operating systems. The. m extension indicates that the file is using the OBJECTIVE-C code. Like the C language, Objective-c uses header files to contain the life of elements such as structs, symbolic constants, and function prototypes. #import是由Xcode使用的编译器提供的, Xcode will use it when you compile Objective-c, C, and C + + programs. #import可保证头文件只被包含一次, regardless of how many times this command appears in the change file. The foundation framework deals with the characteristics of layers (layer) under the user interface, such as data structures and communication mechanisms. The NS prefix tells us that the function comes from cocoa rather than other toolkits. The @ symbol is one of the features that objective-c adds to the standard C language. The @ symbol means that the string within the quotation marks should be treated as a nsstring element of the cocoa. The bool in OC is actually a type definition (typedef) of the signed character type (signed char), which uses 8 bits of storage space. Define yes with the # define directive as 1,no defined as 0. OC does not treat bool as a true Boolean type that can only hold yes or no values. The compiler still views bool as a 8-bit binary number, and yes and no values are just a habit of understanding. If you accidentally assign an integer value greater than 1 bytes (such as short or int) to a bool variable, only the low-level byte is used as the bool value. If the lower byte is just a bit 0,bool the value will be considered to be 0, i.e. no value. The value of Yes is expressed as an integer of 1, do not compare the bool value with Yes directly, it must be safe to compare directly with no, because the false value in C is only one 0.

Departure, inheritance of C

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.