I am trying to make a Array of arms in the Creature class and all the creatures to share the same array of objects(arms). So I tried to do that ...but I don't know how to repair this problem ... please try to explain me at a beginner level, also if you can please provide me some links to read about using "static" correctly !
#include<iostream>
namespace
{
int x = 5;
}
class Arms
{
public:
int arms = 45;
};
class Creature
{
public : int health;
int mana;
int dmg;
Arms *b[188];
Creature(int);
};
Creature::Creature(int z )
{
for(int i = 0 ;i< z; i++)
{
b[i] = new Arms; //<---this is my problem
b[i]->arms = z; // <-- this is my problem
}
}
int main()
{
Creature c1(12);
return 0;
}