初始化

- (id)initWithName:(NSString *)name
            gender:(NSInteger)age{
                 if(self = [super init]){
                     _name = name;
                     _age = age;
                 }
                 return self;
            }

便利构造器

+ (id)personWithName:(NSString *)name
              gender:(NSInteger)age{
              Person *person = [[Person alloc]initWithName:name gender:gender];
              return person;
              }

Baaaan
144 声望1 粉丝

我偏要勉强.