我使用 C++ 比使用目标 c 更有信心,我只是遇到了试图比较两个对象(我正在构建的 UniqueWord 类)的愚蠢问题。我不断收到错误,期望一个类型;这是一个基本问题,但我也想解释一下我是如何做错的,这是我用 C++ 写的。工作得很好
private:
vector <int> LineNumbers;
string wordCatalog;// the current word in the line number
int newIndex(const int);
public:
UniqueWord(const string,const int);//creates the unique word object
~UniqueWord(void);
void addLine(const int);
static int compare(const UniqueWord&, const UniqueWord&);//my issue here
string toString() const;
我的问题是在Objective C中输入这个。这是我在Objective_c中输入的
@interface UniqueWord : NSObject
@property NSMutableArray *LineNumbers;
@property NSString *wordCatalog;
UniqueWord *UWord(const NSString*, const int);//creates a unique word object
int newIndex(const int);
-(void) addLine:(const int)line;
-(static NSInteger) compare:(UniqueWord *self)a with:(UniqueWord *self)b;//my issue
-(NSString*) toString;
@end
我非常感谢解释基本的语法规则(用现代语言解释),所以下次我不会遇到这个麻烦,谢谢。再说一次,我对 Objective C 不是很有信心
在旁注中,有人可以告诉我,如果我是 uniqueWord 构造函数,对吗?它说//创建一个唯一的单词对象