How to make object pointer NULL without setting it explicitly, without deleting explicitly and without static functions?
<p>I am working on a c++ application.
  In my code i have an object pointer like
      TestClass *pObj = new TestClass();
  and Member function call like pObj->close();
  Inside close() member function, i should make pObj to NULL.
  As per our requirement, TestClass users should not call delete on pObj.(Destructor of TestClass is made private intentionally for this purpose)
 Also, TestClass should not expose any static method to receive a pointer and making it NULL.</p>

<p>Is there any other way to make pObj to NULL once close() is called ?</p>

<p>I tried one way.
 Inside close() function, i removed constness for this pointer using const_cast.
 and took a reference of it.
 Then i made this = NULL.
 Even then calling side, pObj pointer value remains. It is not getting set to NULL.
 It may be due to the Address of this pointer and Address of pObj are different.
 Pls help.</p>

<p>EDIT:  Sorry, i missed something. new is getting called inside a static function called init. init function is like below. void init(TestClass *&amp; pObj); So TestClass user calls init first for allocation. But he can't call deinit(there should not be any such function) Actually, this is not my design. It was present when i entered this project :(</p>
