If I'm using an assignment operator overload with dynamic memory should I check to see if there's something inside the pointer already?
for example if object A has a dynamic memory allocation in the constructor for an array called "name".
stored in object A is the name "John" with the memory allocated in the constructor through
name = new char[strlen(userinput)+1];
If I wanted to copy object B into object A through an assignment operator overload would I have to write
if(name != null){delete [] name;}
name = new char[strlen(src.name)+1];
To first clear the array out or do I not have to delete name before reallocating memory?