avatar
问个object suicide问题# Programming - 葵花宝典
d*n
1
鬼子的datafeed里面的产品名称和性能描述都是英文的。
如何汉化呢?
最佳方案?先导入后汉化,如何操作?
或者先汉化后导入,如何操作?
多谢。包子一堆
avatar
b*y
2
class base
{
public:
f(void) { delete this; }
};
class derived : public base
{
};
int main()
{
derived D = new derived();
D->f();
}
which object is deleted?
avatar
d*n
3
I thought "this" is a constant pointer. so, can this be deleted? maybe you
will get a compiler error.
avatar
s*e
4
first, in your main function, you should make the derived object with new
operator, such as:
derived * pD = new derived();
pD->f();
and then, the base part of the object is deleted. And that's why you should
put a virtual destructor in base, in that case the whole object is deleted.

【在 b***y 的大作中提到】
: class base
: {
: public:
: f(void) { delete this; }
: };
: class derived : public base
: {
: };
: int main()
: {

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。