That's not a class problem so much as the fact you can't run non-initialization code outside of functions like that. Either of these would work:
Code:
class Character {
string name = "default";
Character(){}
}
Character Guy;
void onLevelLoad() {
Guy.name = "Peter";
}
or
Code:
class Character {
string name = "default";
Character(){}
Character(string newName) {
name = newName;
}
}
Character Guy("Peter");
__________________
|