cppファイルの「use」関数で「isnotatypename」というエラーが発生し続けます。「アイテム」のデータを格納するために、構造体の配列を作成しようとしています。私はテキストベースのRPGゲームを作成しているので、キャラクターのさまざまなアイテム(構造体配列内)を使用するためのuse関数を持つアイテムクラスを作成しようとしています。私はこれをいくつかの異なる方法で書き、他の方法で呼んでみましたが、このエラーをなくすことはできません。構造体をクラスの前や公共の場などに配置することもできます。
class Items
{
private:
struct eating
{
int itemNumber;
char name[30];
};
public:
Items();
eating useables[10];
void use(useables);
};
void Items::use(useables) // Error is here, tells me useables is not a type name
{
// To use items on characters
}