This is such a simple issue, it's embarrassing to have to ask.. but I've been having trouble with this theoretical issue of defining string arrays (and even integers!) outside of their class. Here's some code:
#include <iostream>
#include <string>
using namespace std;
class desu {
public:
string ok[4]; // Give string 4 elements of space
} s;
s.ok[] = {"one", "two", "three", "four"};
// Calling upon object "s" to access class "desu"
int main()
{
cout << "Write some generic stuff here";
return 0;
}
Now, do I actually need to define a public function WITHIN class 'desu' (privatizing the variables, of course) and, outside the class, call upon that function just to fill my string array?
Granted, I've even tried this with integers (just to make sure that I'm not screwing up with string arrays) and i still get compile errors, eg:
#include <iostream>
using namespace std;
class desu {
public:
int lol;
} s;
s.lol=5;
int main()
{
cout << "Write some generic stuff here";
return 0;
}
Thank you dearly for any help.