Shallow and Deep copies

I wanted to ask about the idea of them because I didn't find anything about it in the tutorial ... thanks .
A shallow copy copies a pointer.

A deep copy copies what that pointer points to.

Example:

1
2
3
4
5
6
7
int* original = new int(5);

// a shallow copy of 'original'
int* shallow = original;

// a deep copy of 'original'
int* deep = new int(*original);
Topic archived. No new replies allowed.