Reputation: 190709
I need to read XML file and store all the info inside variables/class when the software starts, and make the variables/classes be accessible every class.
With C++, I could use global variables or classes, even though it's not a good practice to have a global variables.
Upvotes: 2
Views: 726
Reputation: 12670
static class with static public variables
read/write can be done this way:
private int _someInt;
public int SomeNumber{
public get {return _someInt;}
private set {_someInt = value;}
}
Upvotes: 2
Reputation: 4939
You could use a public static class, and make everything available from there. You could populate it with data at creation time. It won't technically be at global scope, but would make the data easily available, and you wouldn't explicitly have to instantiate anything.
Upvotes: 9