阅读背景:

继承没有虚析构函数的类

来源:互联网 

I've always heard that you shouldn't inherit from a class without virtual destructors, and I didn't pay much attention because I just don't use inheritance all that often. Does this rule apply even if you don't want to use polymorphism, but you just want all of a class functionality, and you want to add some more? To be concrete, would the following class be safe, with well defined behavior, as long as I didn't use it polymorphically? (i.e. no deleting base pointers to derived objects)I've always heard that you shouldn't inherit fr




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: