虚拟析构函数 [英] virtual destructor

查看:101
本文介绍了虚拟析构函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与其他虚拟函数一样,虚拟析构函数的输入是否存在?VTABLE中的


Like other virtual functions does the entry of virtual destructor exist
in VTABLE?

推荐答案

siddhu写道:
像其他虚拟函数一样虚拟析构函数的输入是否存在于VTABLE中?
Like other virtual functions does the entry of virtual destructor exist
in VTABLE?




一般来说,它'因为没有保证

有vtable,所以依赖于实现。编译器可以使用其他技术来实现

虚拟调度(虽然我不知道有什么用)。请参阅此常见问题解答:

http://www.parashift.com/c++-faq-lit....html#faq-20.4


在任何实现vtable的实现中但是,我猜是的,

确实如此。


干杯! -



In general, it''s implementation dependent since there is no guarantee
that there is a vtable. Compilers can use other techniques to implement
virtual dispatching (though I don''t know of any that do). See this FAQ:

http://www.parashift.com/c++-faq-lit....html#faq-20.4

In any implementation that implements vtables, however, I''d guess yes,
it does.

Cheers! --M


siddhu写道:
像其他虚拟函数一样,虚拟析构函数的输入存在于VTABLE中?
Like other virtual functions does the entry of virtual destructor exist
in VTABLE?




是的,但仅当实现实际上具有VTABLE时。标准

不需要它,所以它不是真正的C ++语言功能,它只是一个实现细节。


V



Yes, but only if the implementation actually has VTABLE. The Standard
does not require it, so it is not really a C++ language feature, it''s
just an implementation detail.

V


2006年1月5日10:00:29 -0800,mlimber <毫升***** @ gmail.com>写道:
On 5 Jan 2006 10:00:29 -0800, "mlimber" <ml*****@gmail.com> wrote:
siddhu写道:
像其他虚拟函数一样虚拟析构函数的输入是否存在于VTABLE中?
Like other virtual functions does the entry of virtual destructor exist
in VTABLE?


一般来说,它依赖于实现,因为无法保证存在vtable。编译器可以使用其他技术来实现虚拟调度(虽然我不知道有什么用)。请参阅此常见问题解答:



In general, it''s implementation dependent since there is no guarantee
that there is a vtable. Compilers can use other techniques to implement
virtual dispatching (though I don''t know of any that do). See this FAQ:




我很好奇:请命名一个*当前* C ++编译器,它不使用

vtables。只是问。


风筝在风中升得最高 - 而不是它。

- 温斯顿丘吉尔



I''m curious: Please name one *current* C++ compiler that does not use
vtables. Just asking.

"Kites rise highest against the wind - not with it."
- Winston Churchill


这篇关于虚拟析构函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆