------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! The---class itself is also an object, which is a class-type object, referred to as the *p = [[Person alloc] init]; Person *P1 = [[Person alloc] init];//gets the class object in memory Class C = [P class]; Class C1 = [P1 CLASS];C==C1//Get Class object in memory Class C2 = [Person Class];c==c1==c2person * p = [C2 new]//by default, when using NSLog and%@ output objects, the result is :< class Name: Memory address >//1, will call the object P-description method//2, get the-description method return value (NSString *) display to the screen//3,-description method by default returns "class name + Memory Address "NSLog (@"%@ ", p); To output the details of an object, override it in the object implementation only-DescriptionMethod (The ToString method in Java)-(NSString *) description//decidesInstance ObjectThe output {return [NSString stringwithformat:@ "age=%d,name=%@", _age,_name];} + (NSString *) description//decisionClass ObjectOutput, if not overridden, the default output when the class name of the class object {return @ "abc";}//When the program starts, it loads all the classes in the project once, the class is loaded and the +load method is called (the Load method of the class is called first, and then the load method of the category is called) + (void) load{}//when this class is first used, the +initialize method + (void) initialize{} classification can also be called by the load and initialize methods, and the Load method is loaded. If there are initialize methods in both classes and classifications, then the Initialize method in the class is called the first time, and no +initialize 1 in the class is invoked, and when the program starts, all classes and classifications in the project are loaded. Moreover, the +load method is called without various types and classifications. Only 2 is called once, when a class is first used, the +initialize method () 3 of the current class is called, the parent class is loaded, the child class is loaded (the +load method of the parent class is called first, the +load method of the subclass is called) First initializes the parent class, and then initializes the child class (the parent class's + Initialize method, then call +initialize of subclass)
Dark Horse Programmer--the essence of class