cpp/object_oriented/deep_copy_and_shallow_copy #84
Replies: 2 comments
-
但是把这份代码中的深拷贝全去掉了,也不会影响obj1 |
Beta Was this translation helpful? Give feedback.
0 replies
-
实际在适配C++11后,通常使用智能指针解决深拷贝问题 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
cpp/object_oriented/deep_copy_and_shallow_copy
C++ 中深拷贝和浅拷贝 面试高频指数:★★★★☆ C++中的深拷贝和浅拷贝涉及到对象的复制。 当对象包含指针成员时,这两种拷贝方式的区别变得尤为重要。 浅拷贝(Shallow Copy) 浅拷贝是一种简单的拷贝方式,它仅复制对象的基本类型成员和指针成员的值,而不复制指针所指向的内存。 这可能导致两个对象共享相同的资源,从而引发潜在的问题,如内存泄漏、...
https://csguide.cn/cpp/object_oriented/deep_copy_and_shallow_copy.html
Beta Was this translation helpful? Give feedback.
All reactions