Person *p1=[[Person alloc]init];
Person *p2=[[Person alloc]init];
Person *p3=[[Person alloc]init];
Class c1=[p1 class];
Class c2=[p2 class];
Class c3=[Person class];
NSLog(@"c1=%p,c2=%p,c3=%p",c1,c2,c3);
3.2 Class initialization (load, initialize)
Person *p=[[Person alloc]init];
Class c=[p class];
[Person test];
[c test];
Person *p2=[[c new]init];
NSLog(@"Person ---%d",p2.age);
Four + load and + initialize
4.1 +load
All classes and categories are loaded when the program starts, and the + load method of all classes and categories is called
Load the parent class first, then load the subclass: that is, first call + load of the parent class, and then call + load of the subclass
Load the original meta-class first, and then load the category
Regardless of whether this class is useful when the program is running, + load will be called to load
4.2 +initialize
When you first use a class (such as creating an object, etc.), the + initialize method will be called once
A class will only call the + initialize method once, first call the parent class, then call the subclass
4.3 2 ways to get class objects
//方式一
Class c=[Person class];//类方法
方式二
Person *p=[Person new];
Class c2=[p class];//对象方法