I know that c2 is shallow copied into c3. But how to show that to audience that it is a shallow copy rather than deep copy. I know i can't use delete to destroy contents of c2 and then print c3 nor can i use a manual destructor . It would be useful if someone can tell me how to delete object c2 so that i may show content of c3 and c2.
which you are already doing. What exactly are you trying to demonstrate? I suspect you might be trying to show that c3 is a separate object and not the same thing as c2. In which case, this will do it:
Since class CountDn contains only plain old data, a shallow copy and a deep copy are the same thing - just a copy. So if you're trying to demonstrate the difference between shallow and deep copies, you need a different example.
Shallow copy and deep copy are different for pointers. With a shallow copy, you copy the pointer itself. As a result, both the original and the copy will point to the same data. With a deep copy, you make a copy of the pointed-at data and change the pointer. So the original and the copy point to distinct data. For example (this is untested):
1 2 3 4 5 6 7
int *p1 = newint{1};
int *p2;
p2 = p1; // shallow copy
*p1 = 3; // *p1 and *p2 are now 3.
p2 = newint {*p1}; // deep copy
*p1 = 4; // *p1 is 4, *p2 is still 3.