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++类。如果我从类中删除协议相关的代码,那么代码编译得很好。有没有办法重构上面的代码并将其编译?