黑马程序员技术交流社区

标题: 一道Object-c的类实现经典 [打印本页]

作者: 周易    时间: 2014-8-21 22:11
标题: 一道Object-c的类实现经典
@implementation MyClass
   
- (id)initWithString:(NSString *) aName
{
    if (self = [super init]) {
        count count = 0;
        data = nil;
        name = [aName copy];
        return self;
    }
}
  
+ (MyClass *)createMyClassWithString: (NSString *) aName
{
    return [[[self alloc] initWithString:aName] autorelease];
}
@end
作者: そ花痕ゐ蝶梦    时间: 2014-8-21 23:43
技术有限,实在是看不懂呀!!!
作者: 王绍明    时间: 2014-8-21 23:58
呵呵 最好注释一下
作者: 爱情路13号    时间: 2014-8-22 01:09
周同学,你都学的这么深入啦




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2