Hi. I recently started learning programming (again) and in my practice game that I've been concepting I ran into some problems.
First, I would like to list all existing instances of a certain class. The class is a country in this game, and it's instances are of course Germany, France etc. What I'd want to achieve is that when the player is given a choice, I'd have some handy way of listing his targets, which would be the countries. Doing this manually for every choice and country would be an immense work and produce a lot of hard coding. Is it even possible to do this?
Second, the country class has methods of course, and I thought that I had partially solved the problem of choosing targets with this trick
I thought that that would work but visual studio complains that it's a build error since string doesn't contain blah blah. So is it even possible to have the user fill name for class in code like that?Code:Console.WriteLine("Choose target country"); string plrChoice = Console.ReadLine(); (plrChoice).sampleAction();
Sorry if I'm confusing, just starting out this thing.
ps. the "game" is just a simple console application