我有一個實現協議的類。在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