嘿,我想使用的功能狼故事情節變量和IM試圖做到這一點:無法使用函數變量?錯誤表達必須有類類型
"\nYou awake on a beach to the sound of"<< Wolves().name; " starving and blood hungry,"
"\nThere is a Rock on the ground. You pick it up";
inventory.push_back("Rock");
但狼()的名稱;標題中提到了一個錯誤。爲什麼不能這樣做?
下面是功能狼隊代碼:
void Wolves()
{
string name = "Wolves";
int health = 20;
hitPoints() +1;
}
看來你需要一個類,而不是一個功能 – szx