Frequently while programming there will be need to create a copy of an existing object. This can be done in three ways: Shallow Copy In this method the copy (object) only copies the addresses (for dynamic memory) of the source object’s members. This is similar with the semantics of static data members. A same copy is shared among several objects. Similarly, in shallow copy method, both the source and copied objects share the same memory location. Deep Copy In this method the copied object maintains a copy of the value of each source object’s data members.
The post What are the different ways to copy objects in c++ appeared first on Coding Security.
What are the different ways to copy objects in c++
read more
Tidak ada komentar:
Posting Komentar