c++ - Is better to think of the '=' operator as morphing? -
this trivial question.
i have minimal background in c++ , if remember correctly have been told think of operator way:
int x = 1,y = 2; x = y; //put whatever in y x;
but after reading lvalues , rvalues, think more suitable think of way: morph (change) whatever in x whatever in y. reason think because object referenced x semantically still same object right?
not sure if makes difference data type int
whether view replacement of it's value "put whatever in x y" or "morphing". anyway, online c++ standard draft concerning assignment operator describes process follows:
5.17 (2) in simple assignment (=), value of expression replaces of object referred left operand.
not sure if answers question, taking formulation 1 "the value of object replaced, object remains same".
Comments
Post a Comment