1. Category Category
①. class is to add a method to a class inside the system or to a class that does not have source code, and cannot add an instance variable
② . The added method is referred to as part of the original class, and subclasses can still use the
③. class Destination file name is original + file name (for example: Nsstring+wuyaun)
④. you can either add an instance method or add a class method
2, Extension extension
①. extensions are for custom classes that extend the functionality of the
②. above the . M file, build the extension using the @interface keyword
③. in the extension, we can either declare a method or declare an instance variable or property
④. the added content belongs to the private part of this class.
3, delegate agreement, agent execution.
@class A; // tell compiler a is just a class name, as to what instance variables, properties, methods are not known in the class
4. polymorphic Applications
//Polymorphic , is a variety of forms, There are many states there must be inheritance
//The nature of polymorphism is that the parent pointer points to the child class object
//polymorphic use, the system dynamically monitors what type the pointer is pointing to, althoughcar is a car * type pointer, but when car executes the method alone, TA is the Benz object
// parent pointer as a function or a parameter to a method, when executing a method or invoking a function, passing in a specific subclass object, you can execute methods such as.
Polymorphic Disadvantage, the parent pointer must be able to execute a subclass of methods, can only perform inherited methods, if you want to use, you have to do a strong turn.
OC Section nineth class Extension