今天刚学了类方法,
- @interface HMPerson : NSObject{
- NSString *_name;
- int _age;
- }
- +(HMPerson *)person;
- +(HMPerson *)personWithName:(NSString *)name andAge:(int)age;
- @end
- @implementation HMPerson
- + (HMPerson *)person{
- return [HMPerson new];
- }
- +(HMPerson *)personWithName:(NSString *)name andAge:(int)age
- {
- [HMPerson personWithName:@"小明" andAge:13];
- }
- @end
复制代码
除了这两种还有那些使用方法,表示什么意思
感觉很容易和对象方法搞混淆,求帮助 |
|