What is the difference between shallow copy and deep copy?



What is the difference between shallow copy and deep copy?..

Answer / hrpynux@gmail.com

A shallow copy constructs a new compound object and then (to the extent possible) inserts references into it to the objects found in the original. A deep copy constructs a new compound object and then, recursively, inserts copies into it of the objects found in the original.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

How a new element can be added or pushed in a stack?

0 Answers  


Differentiate between a deep copy and a shallow copy?

1 Answers  


What do you mean by function overriding & function overloading in c++?

0 Answers  


What is pure virtual function? Or what is abstract class?

0 Answers  


What is Name Decoration?

2 Answers   Lucent,






What is the rule of three?

0 Answers  


What is the difference between a type-specific template friend class and a general template friend class?

0 Answers  


Is c++ free?

0 Answers  


string somestring ; Which of the following choices will convert a standard C++ string object "somestring" to a C string? a) Copy.somestring () ; b) somestring.c_str () c) &somestring [1] d) std::cstring (somestring) e) (char *) somestring

1 Answers   Quark,


What are single and multiple inheritances in c++?

0 Answers  


class X { private: int a; protected: X(){cout<<"X constructor was called"<<endl;} ~X(){cout<<"X destructor was called"<<endl} }; Referring to the code above, which one of the following statements regarding "X" is TRUE? a) X is an abstract class. b) Only subclasses of X may create X objects. c) Instances of X cannot be created. d) X objects can only be created using the default copy constructor. e) Only friends can create instances of X objects.

2 Answers   Quark,


What is vector string in c++?

0 Answers  


Categories