Hello Tomislav,
Thanks for sharing great information.
I tried what you said about the default copy constructor, but the memory address of those objects are not the same I've commented those addresses in front of them. so it seems that the default copy ctor uses deep copy.
can you help me to figure out what is wrong?
thanks
You want to create a new instance of Student with a pointer. The pointer points to a memory address when you create the first object. When you shallow copy it, it also copies the memory address of the first student.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hello Tomislav,
Thanks for sharing great information.
I tried what you said about the default copy constructor, but the memory address of those objects are not the same I've commented those addresses in front of them. so it seems that the default copy ctor uses deep copy.
can you help me to figure out what is wrong?
thanks
Link to my code:
dev-to-uploads.s3.amazonaws.com/up...
You want to create a new instance of Student with a pointer. The pointer points to a memory address when you create the first object. When you shallow copy it, it also copies the memory address of the first student.