I'm writing some software and im a little worried about leaking memory. If i create an object or array, and then assign that variable to a new instance of that object, will the memory of that previous object be freed?
double varA = new double;
MyObject varB = new MyObject();
varA = new MyObject(); // Will the object previously stored be freed?
varB = getNewArray(); // Will the array previously stored be freed?
// getNewArray() returns a pointer to a double array that was created in the function