Question:Consider the following code:
template<class T> void Kill(T *& objPtr)
{
   delete objPtr;
   objPtr = NULL;
}

class MyClass
{
};

void Test()
{
   MyClass *ptr = new MyClass();
   Kill(ptr);
   Kill(ptr);
}
Invoking Test() will cause which of the following? 

A Code will Crash or Throw and Exception 

B Code will Execute, but there will be a memory leak 

C Code will execute properly 

D Code will exhibit undefined behavior 

+ Answer
+ Report
Total Preview: 758

Copyright © 2024. Powered by Intellect Software Ltd