Is it a smart idea to make all the variables in a program modified at runtime by the programmer?
I was thinking about this from C ++, mostly from an external editor or something the programmer might say: MyClass :: dude = "hello" where 'dude' is a static integer in 'MyClass'.
What the program does at runtime is it splits the input into MyClass :: dude = "hello" and finds a class called MyClass and assigns it a dude variable as "hello".
The idea behind this is to act as a kind of runtime debugger.
Is this safe / normal?
a source to share
Yes, this is a typical tool used during development to help fine tune games. It's not as common as you type as much as on screen where you can tweak variables on the fly with a controller (which modifies some class variable under the hood), but for PC gaming there is no reason you couldn't "t enter something, especially if it is text. Of course, you will need to program your own system in which the class notifies part of your engine about this name and how to get some of its variables.
a source to share
Your best bet is to use something like Boost :: python and integrate a real scripting language. This is much less than creating your own minilanguage. For example, he will already know how to handle tasks like "MyClass :: dude =" hello "where" dude "is a static integer in" MyClass ".
a source to share
although not a very neat solution, I sometimes wrap up static versions of variables that I need to change on the fly through the debugger to tweak stuff and then just comment out the appropriate #define when done, especially useful if load times are long and just several vars that you need to set up to test something. but again for something like this you should probably consider data files that can be reloaded at runtime
a source to share
The description is not very clear, can you clarify? Is this something that should happen while the program is running? Or will it run using a variable?
One of the differences between C ++ and Java is that the class names are not actually used in the executable program (unless it has been specially compiled for debugging). Thus, the program cannot force the running C ++ program to find a specific variable in that program.
In any case, not compiling a "debugged" program with enough information and capabilities to do so is not very practical, but it is not clear what you are trying to do.
I also don't quite understand what it has to do with inheritance (title of your question).
a source to share