cpp浅拷贝和深拷贝

一、浅拷贝

Shallow copy: if the field is a pointer to some object, the address of the pointer is copied rather than its contents. (浅拷贝:数据域是一个指针,只拷指针的地址,而非指针指向的内容)

 

二、深拷贝

Deep copy: Copy the contents that pointed by the pointer (深拷贝:拷贝指针指向的内容)

 

posted @ 2022-12-11 14:30  blogzzt  阅读(80)  评论(0编辑  收藏  举报