The code for a member function is associated with a class, not an instance of the class. There is one copy of the code, regardless of how many instances are created (zero, one, a million, etc.) Doing delete this; destroys the instance, but it does nothing for the code for class functions.
1: The this pointer exists only in a non-static member function, so the code will not compile unless it is part of such a function. It must be called by the instance. If there is nothing in the program that would create an instance of the class, then the function does not call anything, but the code for the function still exists at run time; it just does not execute.
2: Class methods are stored in the text segment of the program, and not in the data segment, as you might have guessed. They stay there for a lifetime program. (In fact, the text segment is usually read-only and cannot be changed at run time.)
source share