Original Post
Ok, here''s the scenario..
i have a class.. defined in the header file as:
class TEMP
{
...int variable;
public:
...void setVariable(int &integer);
...int returnVariable();
}
and in the cpp file:
void TEMP::setVariable(int &integer)
{
...variable = integer;
}
int TEMP::returnVariable()
{
...return variable;
}
In my main code however, (in a loop) i wish to do something like this:
int number = 1;
int returnNumber;
TEMP temp;
temp.setVariable(number);
+=Begin Loop=+
returnNumber = temp.returnVariable();
number++;
+=End Loop=+
Simply (*snicker*) put, i need the class to store a pointer to a variable outside of the class, such that when i change the number, the class will point to the new number.
I know the above code doesnt work, thats why im asking here. Any ideas as to how to do this? Arrrgh!
Cheers.