【发布时间】:2011-09-04 09:37:21
【问题描述】:
在 Objective-C 中,我想要一个子类调用或调用父类的方法。就像父母分配了孩子一样,孩子做了一些会调用父方法的事情。像这样:
//in the parent class
childObject *newChild = [[childClass alloc] init];
[newChild doStuff];
//in the child class
-(void)doStuff {
if (something happened) {
[parent respond];
}
}
我该怎么做呢? (如果您能详细解释一下,我将不胜感激)
【问题讨论】:
标签: objective-c methods parent-child class-hierarchy alloc