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