1.

Is It Possible For A Member Function To Delete The Pointer, Named This?

Answer»

It is POSSIBLE for a member function to use delete this pointer but on certain conditions.
The conditions which allow the member function to use delete this are listed in the following ORDER:

  1. Make sure that the allocation of this (current) object is DONE through new [] operator only.
  2. Make sure that the invocation of your member function done on this (current) object will be the last member function. It made the calling of the last member function by the current object easy.
  3. Make sure that calling of other member functions and data members should not be done after the line of code which includes delete this.
  4. Examination or comparison of this pointer with other pointers and with NULL, printing or casting it, MUST be avoided after using the delete this line.

It is possible for a member function to use delete this pointer but on certain conditions.
The conditions which allow the member function to use delete this are listed in the following order:



Discussion

No Comment Found