A copy of a data structure or object in which the structure's pointers point to the same memory locations as in the original, contrary to deep copy in which the pointed data is copied as well.

Let me explain this in a little more detail. Consider the folowing
class foobar
float * fpoint;

Now in the copy constructor I might just copy the value of fpoint into the new class(which is called a shallow copy) . This means that fpointnew and fpoint point to the same memory location and if I try and alter this memory location using fpointnew I end up also changing the value fpoint(old) points to. In a deep copy a copy constructor would be used to create a new location for the new pointer to point to, thus avoiding this problem.

Log in or register to write something here or to contact authors.