问题:
I have a solid understanding of most OO theory but the one thing that confuses me a lot is virtual destructors. 我对大多数面向对象理论有扎实的了解,但令我困惑的一件事是虚拟析构函数。
I thought that the destructor always gets called no matter what and for every object in the chain. 我以为无论链中的每个对象是什么,析构函数总是被调用。
When are you meant to make them virtual and why? 您打算何时将它们虚拟化?为什么?
解决方案:
参考一: https://stackoom.com/question/1vyl/何时使用虚拟析构函数参考二: https://oldbug.net/q/1vyl/When-to-use-virtual-destructors
来源:oschina
链接:https://my.oschina.net/stackoom/blog/3219050