不正确。如果一个类是抽象的,那么根据定义,它具有虚拟的 函数,并且将作为基类(如果它有任何用途)。 在这种情况下,拥有一个虚拟的 析构函数通常非常重要。这个析构函数是否是纯粹的虚拟版本在很大程度上是无关紧要的,但是编译器提供的是*不是*虚拟的,因此不足以支持。 如果它确实包含数据,那么你至少需要看看它们是如何构建或处理的,也许你需要控制它们。Not true. If a class is abstract, then it, by definition, has virtualfunctions, and will serve as a base class (if it is to be of any use).In such a situation, it is usually very important to have a virtualdestructor. Whether that destructor is pure virtual or not is largelyirrelevant, but the compiler-provided one is *not* virtual, and istherefore inadequate. If it does contain data, then you need to at least see how they are constructed or disposed of, maybe you need to take control. - Clark S. Cox,III cl*******@gmail.com--Clark S. Cox, III cl*******@gmail.com 这篇关于纯虚拟析构函数的必要性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-26 00:11
查看更多