如何在 x++ 中销毁对象?
How to destroy an object in x++ ?
当不再有对该对象的引用时,该对象将自动销毁。
这意味着如果我们有一个对象a和对象b并且b持有对a的引用,b 持有对 a 的引用,>a 就不会被收集。
对象a
对象b
b
a
b 持有对 a 的引用,>a 就不会被收集。
如果删除 a 和 b 之间的引用,a 将有资格进行垃圾回收,因此 a 将会在后期被销毁。
您可能想查看此链接:析构函数。
Objects are automatically destroyed when there are no more references to the object.
This means that if we have a object a and object b and b holds a reference to a, a will not be collected as long as b holds a reference to a.
object a
object b
If the reference between a and b would be removed a would become eligible for garbage collection, and thus a will be destroyed in a later stage.
You might want to check out this link: destructors.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
当不再有对该对象的引用时,该对象将自动销毁。
这意味着如果我们有一个
对象a
和对象b
并且b
持有对a
的引用,b 持有对
a
的引用,>a 就不会被收集。如果删除
a
和b
之间的引用,a
将有资格进行垃圾回收,因此a
将会在后期被销毁。您可能想查看此链接:析构函数。
Objects are automatically destroyed when there are no more references to the object.
This means that if we have a
object a
andobject b
andb
holds a reference toa
,a
will not be collected as long asb
holds a reference toa
.If the reference between
a
andb
would be removeda
would become eligible for garbage collection, and thusa
will be destroyed in a later stage.You might want to check out this link: destructors.