2
嗨,嘗試編譯目標C++ /協議代碼,但編譯失敗,出現錯誤「協議之前的預期聲明說明符」以及類似的錯誤,用於以下頭文件中的所有目標c代碼行。在Objective C協議中使用C++對象/類
#import <UIKit/UIKit.h>
#include <Category>
@protocol StoreDelegate <NSObject>
@optional
...//Protocol methods
...
...
@end
@interface Store : NSObject {
id<StoreDelegate> delegate;
BOOL downloadFailed;
Category *currentCategory;
}
@property(nonatomic, assign) id<StoreDelegate> delegate;
+ (Store *)sharedStore;
...//Class methods
...
...
@end
請注意,「Category」是一個C++類。如果我從類中刪除協議相關的代碼,那麼代碼編譯得很好。有沒有辦法重構上面的代碼並將其編譯?