However, in the source file, data is not being recognized as a member and I am given "Symbol 'data' could not be resolved" for those 3 instances of data. What am I not understanding?
Are there any other #includes or other code which might have the name 'data'?
Perhaps there's some naming conflict due to usingnamespace std;
Try removing that line and explicitly put std::cout
delete is used to delete objects allocated with new. delete objectA; shouldn't even compile because objectA is not a pointer. objectA will be deleted automatically when it goes out of scope.
delete is used to delete objects allocated with new. delete objectA; shouldn't even compile because objectA is not a pointer. objectA will be deleted automatically when it goes out of scope.
If objectA is automatically deleted when it goes out of scope, instantiating via Testable objectA;
why is Testable *objectA = new Testable;
not automatically deleted when out of scope?
The pointer is automatically deleted? I thought that once you delete the pointer to the dynamic object it automatically calls the destructor for that class?
{
int x = 1;
int * p = newint;
}
// at this point, both x and p have gone out of scope and no longer exist.
// but the integer pointed to by p still exists. Though we have no way
// to access it now