這些是頭文件我的類函數:類函數的指針
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