OC -- Description Method
1. The description method includes class and object methods. (Included in the nsobject class)
-Description (Object method)
2. When nslog and @ % are used to output an object, the description method of the object is called and the returned value is obtained for output.
+ Description (class method)
3. When nslog and @ % are used to output an object, the description method of the Class Object is called, and the returned value is obtained for output. The entire object is printed at one time, and the printed object uses % @.
4. use @ % to print an object such as ("@ %", P). By default, the output is printed as <Class Name: memory address>, although the string is also an object, however, special characters are used when @ % is used to print strings.
5. The + description method determines the output result of the class object, that is, the class itself.
6. The-description method determines the output result of the instance object, that is, the object created by person.
Sel:
1. the concept of SEL: SEL is actually a method packaging. It encapsulates the method into a sel type of data to find the corresponding method address. After finding the method address, you can call the method. These are runtime features. Sending a message is to send Sel, then find the address based on Sel, and call the method.
2. First, package the test method name into sel-type data;
3. Find the corresponding method address based on sel data;
4. Call the corresponding method based on the method address.
5. Note: There is a cache during this operation. The first search is performed one by one, which consumes a lot of performance and will be used directly later.
6. _ cmd: each method has an internal-cmd representing the current method.