I have this code
class Move
{
public:
Move()
{
name = "";
type_num = 18;
power = 0;
accuracy = 0;
type = "???";
}
Move(string a, int b, int c, int d)
{
name = a;
type_num = b;
power = c;
accuracy = d;
/*lines of code to give type a string variable depending on the value of type_num*/
}
private:
string name, type;
int type_num, power, accuracy;
};
class Moveset
{
public:
Moveset()
{
}
private:
Move slot1{"MOVE 1", rand() % 18, 10*(rand() % 15 + 1), 5 * (rand() % 11 + 10)};
};
And the compiler gave me this Warning for declaring the object slot1 under the private section in class Moveset.
464 83 C:\Users\N\Desktop\C++\Poke\Poke.cpp [Warning] non-static data member initializers only available with -std=c++11 or -std=gnu++11
464 15 C:\Users\N\Desktop\C++\Poke\Poke.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11
464 83 C:\Users\N\Desktop\C++\Poke\Poke.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11
Although it gave me the warning but apparently it didnt affect the programme running. Does it actually affect anything? and what am I doing wrong here?
Edit: And what is the diifference between a static member initializer and non-static member initializer?