RE: Convert String to variable contained in string



The reason I am doing this approach to a problem is because I
don't know how to create a reference to a value type.

For example in C++:
int x = 10;
int *y = &x;

When I update x, I want to be able to see the change in y.

In C# because int is a value type when I say:
int x = 10;
int y = x;
it creates a copy of x and puts it in y.

Is there a way to do this without having to use unsafe construct?

It still would be useful to be able to get the value of a variable in a
string like

string varName = "MyClass.intvalue";
would like to get value of MyClass.intvalue.

So an answer to both issues would be really appreciated.

-Gregory McCallum

.



Relevant Pages

  • Re: encapsulation / concealmeant / data hiding / implementation hiding / whatever you call it
    ... The fact that 'referenceToX' is a reference means that some other object ... int getX() const; ... First, x is in the class for some reason, ie it has some inherent ... can be replaced with a calculation, ...
    (comp.object)
  • Re: K&R2 1.6 Arrays, exercise 1-13 (vertical histogram)
    ... | int main ... I thought you always initialised variables on declaration, ... This, of course, could have been done by initialising on declaration ... (If the latter reason is true, learning it would have done no good here, because Reason 1 would still have applied.) ...
    (comp.lang.c)
  • Re: newbie (dropping numbers) new post
    ... Either use a #define or a constant int here. ... Please note that the above loop is only an example. ... entry error was detected on stdin. ... Reason number 2 for the array idea for scores. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Boost process and C
    ... of int for sizes, rather than size_t. ... read-only and constant strings and detecting errors efficiently ... I do have good reason for doing this. ... If the DOS port hadn't been dropped then depending on the compiler we ...
    (comp.lang.c)
  • Re: what is wrong?
    ... The only reason you "should" get no output is if the int 21h/47h fails. ... After the "xlatb", ...
    (alt.lang.asm)