I'm new to coding in C++ and more used to some simple Java programming.
I made two classes, class A(int)
and class B
. I made an array filled with names, and I want int A
to say one of the names from class B
.
Example:
Class B {
static string NPCnames[] { "John", "Mike", "Alex", "Adam"};
};
int A {
cout << B::NPCnames[rand()]
};
It comes up with errors for the arrays (because I'm new I don't understand them)
Error message:
Error 1 error C2864: 'Data::NPCnames' : a static data member with an in-class initializer must have non-volatile const integral type