3 ms·
All of which is a workaround for the fact that there is no explicit way to declare a c++ class to be abstract-only. What happens if you do have shared logic to
by jimwise 16y ago
All of which is a workaround for the fact that there is no explicit way to declare a c++ class to be abstract-only.
What happens if you do have shared logic to put in the abstract base class's destructor? It can't be pure virtual, and you're back to being able to instantiate your 'abstract' base class...
- _stephan 16y agoWhat about making the constructors protected?
- thought_alarm 16y ago> All of which is a workaround for the fact that there is no explicit way to declare a c++ class to be abstract-only. Sure you can. Just put the word "Abstract" in the class name, and then every programmer who reads that class name will know that it's abstract. What more does one need? That approach is much clearer than resorting to tricks like a pure virtual destructor. At the end of the day it's all about communicating design.