In isolation (i.e. since no information is provided about code that uses the Person2 class) this "use case" is one of a poorly implemented reference counted object, in which other code calls Person2::create() to create an instance, uses the add_ref() member to increment a reference count, and the release() to decrement that reference count (and presumably other operations on the object while it is alive).
When the release() member function is called more times than add_ref(), the object commits suicide by doing delete this.
For example;
Person2 object = Person2::create();
object->add_ref();
// do operations on the pointed to object
object->release();
// do more operations on the pointed to object
object->release(); // object commits suicide here
The reason I say this is poorly implemented is that, in the preceding code, there is nothing preventing the caller misusing the object after it commits suicide. For example, there is nothing to prevent the above being modified to
Person2 object = Person2::create();
object->add_ref();
// do operations on the pointed to object
object->release();
// do more operations on the pointed to object
object->release(); // object commits suicide here
// do yet more operations on the pointed to object without calling Person2::create()
object->release();
The two additional lines cause undefined behaviour.
The only way for the calling code to prevent undefined behaviour is to explicitly ensure that it doesn't call object->release() too many times, and not dereference object (e.g. call non-static member functions, or access data members) after it has committed suicide. In other words, the calling code needs to separately keep track of the object's reference count as well.
So all that is being achieved by an instance of Person2 managing its own reference count is forcing code which uses the class Person2 to also separately manage a reference count for each object it uses (or some other explicit approach to ensure it never calls object->release() too many times).
Contrary to other comments and answer, this is not a "poor man's shared_ptr". A shared_ptr is an object that manages the lifetime of another object, and cooperates with other shared_ptr instances to ensure the managed object is destroyed correctly. This Person2 class does nothing of the sort.
shared_ptrmanages the lifetime of another object in cooperation with othershared_ptrs, and the lastshared_ptr, as it ceases to exist, destroys that managed object. This code is of an object that destroys itself based on the number of calls ofadd_ref()andrelease(). Too many calls ofrelease()cause undefined behaviour, so this object relies on the code callingrelease()managing itself correctly.shared_ptr.