【发布时间】:2010-07-27 04:02:26
【问题描述】:
我有一个名为 ModelBase 的基类,我有一个名为“Person”的派生类。 现在在人的 init 方法中,我有类似的东西
-(Person*) init {
if(self = [super init])
return self;
return nil;
}
然而,Objective C 抱怨说 初始化“struct ModelBase *”的不兼容 Objective-C 类型,预期为“struct Person *”。我只是用 [super init] 初始化 self ,它正在初始化指向派生类的基类指针。
我错过了什么?
【问题讨论】:
-
你的标题是什么样的?
标签: iphone objective-c