The delete operator works only on an actual pointer. You are using it on an object on the stack.

That might work if you overload the delete operator. But I've never tried that before, and I don't think it could work on a non-pointer. You could make a delete() function, though.

But I don't see why you would want to give a member-variable the value NULL if the whole object is deleted anyway (which is what's happening when the destructor is called).

I think the delete() function is what you want.