这些是头文件我的类函数:类函数的指针
public:
hunter(string aSpecies); // create a hunter of the given species
void recordKills(string kill); // add a new kill to the end of the hunter's list of kills
string *theKills(); // return a pointer to the array of all kills by this hunter
int numberOfKills(); // how many kills have been recorded
和类变量:
private:
string kill;
int numberkilled;
string kills[20];
我不知道该如何处理“串* theKills()”
我试图做这样:
string hunter::*theKills(){
pointer = kills;
return pointer;
}
与*不能识别kills
作为我的类变量的一部分,但我们应该使用相同的函数名称。
不应该是'string * hunter :: theKills(){'? – songyuanyao