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
How would you call C functions from C++ and vice versa?
Which one is better- macro or function?
Are there interfaces in c++?
What is #include cstdlib in c++?
What is ostream in c++?
What is the basic structure of c++ program?
Write about the members that a derived class can add?
What does it mean to declare a member variable as static?
What is microsoft c++ redistributable 2013?
Can we distribute function templates and class templates in object libraries?
What is atoi?
What is a c++ class?
Why are arrays usually processed with for loop?
How to declare a pointer to an array of integers?
Can we change the basic meaning of an operator in c++?