Hi there, I am tryign to write a function and i need part of it to access and change the variables of an object (seems simple enough)
I create the object using
in the main() function of a .cpp file.
Below is the constructor for the object:
This object 'result' is then passed by reference to a function in a header file:
canyon_section( int first_value, int second_value )
: first_value_( first_value ),
Second_value_( second_value )
i then use the code:
next_section_result = get_next_section(result);
to try and modify the 2 integer values of the object.
result.first_value = random_int();
result.second_value = random_int();
Only problem is when I try to compile the main.cpp file I get a compile error:
'invalid use of member (did you forget the `&' ?) '
with a line reference to the 'result.first_value.....' line (same error for the second_value line as well).
Am i missing something?
*edited to include funciton call & constructor