我收到编译错误structure required on left side of . or .*
,chest.contents[0]
但chest
它是一个结构:
class Item {
public:
int id;
int dmg;
};
class Chest {
public:
Item contents[10];
};
int main()
{
Chest chest();
Item item = chest.contents[0];
return 0;
}