> The only way you can call it is by qualifying the function call with A:: in front like keskiverto did on line 11.
If the destructor is pure virtual with a definition, the destruction of the base class sub-object would invoke it. Also a call to any pure virtual with a definition from within the constructor or destructor of the abstract base class.
> Why would this be useful?
It is actually required if the standard wants to allow the destructor of a class to be pure virtual. The standard makes a specific mention of this:
A prospective destructor can be declared virtual and with a pure-specifier. If the destructor of a class is virtual and any objects of that class or any derived class are created in the program, the destructor shall be defined. http://eel.is/c++draft/class.dtor#12
> it still doesn't explain why you would want to make the destructor pure virtual in the first place.
Herb Sutter:
2. Why might you declare a pure virtual function and also write a definition (body)? Give as many reasons or situations as you can.
There are three main reasons you might do this. #1 is commonplace, #2 is pretty rare, and #3 is a workaround used occasionally ...
Most programmers should only ever use #1.
#1. Pure Virtual Destructor
... If the class should be abstract (you want to prevent instantiating it) but it doesn't happen to have any other pure virtual functions, a common technique to make the destructor pure virtual
#2. Force Conscious Acceptance of Default Behaviour
...
Thanks you everyone for your good explanation which are really interesting. The examples that you showed are explicit - clever. I really appreciate them ++