changing objects parameters via getters inside functions in c++?
Hi,
I have an object A and pass it some function that calls its setters to reset some data members.
e.g.
void A(B b){ b.SetWhatever(2)}
then after calling A b indeed has the parameters reset. The problem comes when I pass b to a function C that calls A. Now inside C, b again has had its parameters changed. But externally to C b has not had its parameters changed,
e.g
void C(B b){ A(b) ;}
why does b have different values for its data members inside C, than outside C? After all in both places it is residing at the same memory address surely?
Thanks,
Mark
|