新对象而不将其分配给任何变量 [英] new of an object without assigning it to any variable

查看:60
本文介绍了新对象而不将其分配给任何变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么要创建新对象而不将其分配给任何变量?


new A;


???

tx

解决方案

ajay写道:

为什么会有新的对象创建时不会将其分配给任何变量?

新的A;


tx




副作用。


-

问候,

巴斯特。


"克星" <无*** @ nowhere.com>在消息中写道

news:c5 ********** @ newsg3.svr.pol.co.uk ...

< blockquote class =post_quotes>为什么要创建一个新的对象而不将其分配给任何
变量?
新的A;

???
tx



副作用。




这是C ++中的内存泄漏。


> > >

new A;


这是C ++中的内存泄漏。



这是,但这很可能不是:


新A(b);


Corno


Why would a new of object be created without assigning it to any of variable?

new A;

???
tx

解决方案

ajay wrote:

Why would a new of object be created without assigning it to any of variable?

new A;

???
tx



For side effects.

--
Regards,
Buster.


"Buster" <no***@nowhere.com> wrote in message
news:c5**********@newsg3.svr.pol.co.uk...

Why would a new of object be created without assigning it to any of variable?
new A;

???
tx



For side effects.



It''s a memory leak in C++.


> > >

new A;


It''s a memory leak in C++.


It is, but this could very well not be:

new A(b);

Corno


这篇关于新对象而不将其分配给任何变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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