本帖最后由 王雪冬 于 2014-4-9 08:40 编辑
请看:- int main()
- {
- Person *p=[[Person alloc] init];
-
- Class c=[p class];
- Person *p2=[[c new] init]; //这一行不太明白?
-
- return 0;
- }
复制代码
创建对象不是有两种方式嘛:
1.Person *p=[[Person alloc] init];
2.Person *p=[Person new];
我先在的理解是 Person 进行new 方法等价于 Person 进行alloc 后再进行init
为什么我标注的地方却是[[c new] init] ?
|