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?
Answer: Code will Crash or Throw and Exception
Test answer is wrong yes? It will not crash as we delete NULL pointer which is safe.