虚拟描述函数 [英] Virtual Destrctor Function
问题描述
当我需要在基类中使用虚拟命运器
函数时,你能不能告诉我?
在此先感谢,
Michael
Michael写道:
当我需要在基类中使用虚拟destctor
函数时,你能不能告诉我?
当一个类的对象应该被多态删除时。
V
-
请在通过电子邮件回复时删除资金''A'
我没有回复最热门的回复,请不要问
Michael写道:
>
当我需要在基类中使用虚拟destctor
函数时,你能不能告诉我?
更好的问题可能在你不在的时候。默认使用
虚拟析构函数,除非你知道你不需要它...你将会b / b
永远不会从基类ptr中删除一个子类。 br />
Victor Bazarov写道:
Michael写道:
当我需要在基类中使用虚拟destctor
函数时,你能不能告诉我?
当一个类的对象应该被多态删除时。
V
-
请在通过电子邮件回复时删除资金''A'
我没有回复最热门的回复,请不要问
我知道一点多态性。如果
可以,你能解释一下吗?
谢谢,
Michael
Hi,
Could you pleaes let me know when I need to use virtual destctor
function in the base class?
Thanks in advance,
Michael
Michael wrote:Could you pleaes let me know when I need to use virtual destctor
function in the base class?When an object of the class is supposed to be deleted polymorphically.
V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask
Michael wrote:Hi,
Could you pleaes let me know when I need to use virtual destctor
function in the base class?The better question is probably when don''t you. Default to using a
virtual destructor unless you KNOW you don''t need it...that you will
never be deleting a subclass from a base class ptr.
Victor Bazarov wrote:Michael wrote:Could you pleaes let me know when I need to use virtual destctor
function in the base class?
When an object of the class is supposed to be deleted polymorphically.
V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t askI know a little of polymorphy. Could you explain it a little more if
possible?
Thanks,
Michael
这篇关于虚拟描述函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!