Double Parsing of Variable

Hi,

I want to use some variables as Follows,
int a = 6;
char b = 'a';

Now I want to access value of variable a from within variable b. is it possible ??

Thanks in Advance
No, not the way you are trying to do it. This is a feature of "reflection", which C++ does not provide any support for.

If you need a reference in code, you could use a reference or a pointer. However, the identifiers themselves do not exist when the code is running, so if they user input "a" there would be no way to know what memory address or data structure that would need to refer to.
Topic archived. No new replies allowed.