+ 5

Could anyone answer my Q:

what do we mean when we say : "the Assignment Operator (=) by Default performs Memberwise Assignment..??

30th Apr 2018, 6:07 PM
RiGeL
RiGeL - avatar
4 odpowiedzi
+ 4
assignment operator (=)sets left member value to value you give at right side
30th Apr 2018, 6:20 PM
Bala Krishnan V
Bala Krishnan V - avatar
+ 4
Just to add - it means 'by default' because you can define how the assignment operator works with your own classes. And memberwise assignment means the objects directly to the left and right of the operator (equals sign). "By default, such assignment is performed by memberwise assignment (also called copy assignment)—each data member of the object on the right of the assignment operator is assigned individually to the same data member in the object on the left of the assignment operator."
30th Apr 2018, 8:12 PM
Zeke Williams
Zeke Williams - avatar
+ 3
welcome RiGel
30th Apr 2018, 6:22 PM
Bala Krishnan V
Bala Krishnan V - avatar
+ 2
adithya213 thanks Bro
30th Apr 2018, 6:21 PM
RiGeL
RiGeL - avatar