当前位置:网站首页>Shallow copy deep copy
Shallow copy deep copy
2022-07-24 22:01:00 【trigger.】
Shallow copy :
- For a data type is a member variable of a basic data type , The shallow copy will pass the value directly , That is to copy the attribute value to the new object .
- For a data type is a member variable that references a data type , Shallow copies are passed by reference , That is to say, only the reference value of the member variable ( Memory address ) Copy a copy to a new object .( In fact, the member variable of both objects points to the same instance , under these circumstances , Modifying the member variable in one object affects the value of the member variable in another object )
- Shallow copy is the default clone() Method to implement .
Deep copy :
- Copy the member variable values of all basic data types of the object .
- Request storage space for all member variables that reference data types , And copy the object referenced by each reference data type member variable , Until all objects that the object can reach . in other words , To make a deep copy of an object, you need to copy the entire object .
- Realization way :1. rewrite clone Method to achieve deep copy ;2. Deep copy through object serialization .
边栏推荐
- LED digital display driver IC and anti-interference LED digital tube display driver ic-vk1s68c ssop24 are applicable to finger clip pulse oximeter, arm electronic sphygmomanometer, thermometer, fetal
- @typescript-eslint/ [email protected]
- Binary search
- [Matplotlib drawing]
- P2404 splitting of natural numbers
- Mathpix formula extractor
- With this PDF, I successfully got offers from ant, jd.com, Xiaomi, Tencent and other major manufacturers
- Microcomputer principle: detailed explanation of CPU architecture
- Jenkins introduction
- Makefile基础知识--扩展
猜你喜欢

day10:声明式事务控制

Applet location interface application

Uniqueness and ordering in set

Both Chen Chunhua and Mo Yan have words of suffering

Composability and Recursion in snarkyJS

The relationship between cloud computing and digital transformation has finally been clarified

2022 Tsinghua summer school notes L2_ 1 basic composition of neural network

Multiplication and addition of univariate polynomials
![Mathematical derivation in [pumpkin Book ml] (task4) neural network](/img/11/8d0f7254c2a22d46f2407b5f773c5c.png)
Mathematical derivation in [pumpkin Book ml] (task4) neural network

Composability and Recursion in snarkyJS
随机推荐
Little Red Book Keyword Search commodity list API interface (commodity detail page API interface)
Big country "grain" policy | wheat expert Liu Luxiang: China's rations are absolutely safe, and the key to increasing grain potential lies in science and technology
腾讯+360+搜狗校招笔试题+知识点总结
运动控制卡应用开发教程之调用激光振镜控制
Class notes (4) (3) -573. Lecture hall arrangement (Hall)
【二分好题】
Conditional judgment of Shell Foundation
2022 Tsinghua summer school notes L2_ 1 basic composition of neural network
[image processing] pyefd.elliptic_ fourier_ How descriptors are used
day10:声明式事务控制
Mathpix formula extractor
Clever use of sort (list & lt; T & gt;, comparator & lt;? Super T & gt;) comparator
Unity & facegood audio2face drives face blendshape with audio
Gradle学习集合整合
Wechat applet monitoring real-time geographical location change event interface application
深入理解事务
Atcoder beginer contest 260 a~f problem solution
CAD sets hyperlinks to entities (WEB version)
"Paper reproduction" bidaf code implementation process (4) model training + verification
What should I do when selecting the RDS instance access method?