Regarding deep copy of constructor

in shallow copy
char +name;
Car(char *n)
{
name=new char[strlen(n)+1];
strcpy(name,n);
}
in deep copy
Car(Car &x)
{
name=new char[strlen(x.name)+1];
strcpy(name,x.name)
}
I can’t understand difference between the two,as in both we are dynamically allocating memory pointed by name pointer and then copying the content of string in memory pointed by name?

Hey @isingh
From where did u get this example
Is it in the video
If its then please share the timestamp(time at which they are discussed)
Otherwise share the source

At timestamp 3:23 and 12:28, it has been discussed

yeah this was wrong

this is not shallow this is also deep
And this isn’t present in vedio i guess

So

this is deep copy and
this one is shallow copy

Car(Car &x)
{
name=x.name;
}

See from 12:30

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.