chsalvia
asked on
Shallow copy with no assignment operator
Given a simple class like:
class Box {
public:
int a;
int b;
};
int main() {
Box b1;
Box b2;
}
Are the following two statements effectively the same? (i.e. do these statements generate the same exact machine code?)
b1 = b2;
memcpy(&b1, &b2, sizeof(Box));
class Box {
public:
int a;
int b;
};
int main() {
Box b1;
Box b2;
}
Are the following two statements effectively the same? (i.e. do these statements generate the same exact machine code?)
b1 = b2;
memcpy(&b1, &b2, sizeof(Box));
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.