我有一个实现协议的类。在MyProtocol,我有两个属性:类是否继承objective-c中的协议?
@protocol MyProtocol <NSObject>
@property(nonatomic, retain) NSObject *stuff;
@property(nonatomic, retain) NSString *stringStuff;
@end
我类实现如图所示的协议
部首的.h
@interface MyClass : UIViewController <MyProtocol>
...
Implementation.m
@implementation MyClass
@synthesize stuff;
@synthesize stringStuff;
...
我有一个类继承自MyClass ...
@interface MySubClass : MyClass
当我尝试访问MySubClass中的东西和stringStuff时,出现MySubClass没有名为'stringStuff'的成员的错误。
我如何获得子类能够访问这些父类的成员?
我想要得到存储在myClass的stringStuff,从MySubClass ....它没有让我这样做。 – John 2011-05-19 22:04:07
你能提供更多的细节吗?你得到了什么确切的错误?它是编译器警告还是运行时错误? – jjwchoy 2011-05-19 23:43:14