Description method
#import "Person.h"@implementation Person- (void) Setage: (int) Age {_age=Age ;}/** Determines the output result of the instance object **/-(NSString *) Description {return[NSString stringWithFormat:@"age=%i", _age];}/** Determines the output of the class object **/+ (NSString *) Description {return @"ABC";}@end//By default (not overridden) when you use the NSLog and%@ output objects, the result is: < class name: Memory address >//the-description method that invokes the object//get the return value of the-description method (NSString *) displayed on the screen//The -description method returns the "class name + memory address" by default;//easy to observe results general override the-description method of the parent class
SEL type
1. Where to store the method
The list of methods for each class is stored in the class object
Each method has an object of the corresponding SEL type
You can find the address of the method based on a Sel object and then call the method
Creation of 2.SEL objects
SEL s = @selector (method name);
SEL s2 = nsselectorfromstring (@ "Test");
Other uses of 3.SEL objects
Convert Sel object to NSString Object
NSString *str = Nsstringfromselector (@selector (method name));
According to Sel tuning method
[P Performselector: @selector (method name)];
[P Performselector: @selector (method name) Withobject: actual parameter];
[Self performselector: _cmd]//will trigger a dead loop _cmd represents the current method
Objective-c Description Method Sel type