[C ++] The difference between the depth of copy

Shallow copy
simple copy
if the pointer will point to the same chip memory space

When deep copy
is needed : there is dynamic allocation of memory, there is a pointer
to copy the memory held by its object once
as a pointer, there are separate memory spaces

Refer

Published 70 original articles · Likes0 · Visits 1705

Guess you like

Origin blog.csdn.net/weixin_44807751/article/details/104410839