What is difference between shallow copy and deep copy? Which is default?
Answer Posted / hrpynux@gmail.com
Default version of clone method creates the shallow copy of an object. To create the deep copy of an object, you have to override clone method. Shallow copy is preferred if an object has only primitive fields. Deep copy is preferred if an object has references to other objects as fields.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are 2 ways of exporting a function from a dll?
Do the names of parameters have to agree in the prototype, definition, and call to the function?
Explain operator overloading.
Refer to a name of class or function that is defined within a namespace?
What is difference between class and function?
What is new in c++?
What does int * mean in c++?
Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
Which operations are permitted on pointers?
Can we distribute function templates and class templates in object libraries?
What is the full form of ios?
What is the use of function pointer?
Define basic type of variable used for a different condition in C++?
What is a type library?
Does a derived class inherit or doesn't inherit?