View Single Post
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,991

Violet CLM has disabled reputation

Aug 28, 2016, 01:43 PM
Violet CLM is offline
Reply With Quote
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");
__________________