嵌套对象引用 [英] Nested Object reference

查看:96
本文介绍了嵌套对象引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在创建一个类,只要它获得一个新值就克隆它。


每个实例都有一组与其获得的值相关的属性:

Hi,

I''m creating a class, that clones itself whenever it gets a new value.

Each instance has a set of properties that are related to the value it gets:

展开 | 选择 | Wrap | 行号

推荐答案

@guillermobytes


好​​的我将抽象我的问题:


每当一个对象是唯一一个引用时插入一组其他对象。

如果该对象未被设置,它引用的对象是否会从内存中清除?
@guillermobytes
Ok i will abstract my question:

whenever an object is the only one referencing a set of other objects.
if that object gets unset, will the objects that it references get cleaned from memory?


出于好奇,为什么你需要嵌套对象?
out of curiousity, why do you need nested objects?


@Dormilich


好​​吧也许我没有表达好,通过嵌套对象引用我的意思是一个对象有一个属性是指向另一个对象的指针,该对象又有一个指向另一个对象的属性等。


我需要这个,因为每个父母都有一个孩子,每个孩子都是一个父母


我不知道如何更好地解释它。


顺便告诉你知道如果我杀了父对象,会吗它的孩子会从记忆中删除吗?
@Dormilich
well maybe I didn''t express it well, by nested object reference i mean that an object has a property which is a pointer to another object, which in turn has a property that is a pointer to another etc.

I need that because every parent has a child and every child is a parent

I don''t know how to explain it better.

btw do you know if i kill the parent object, will its childs get removed from memory?


这篇关于嵌套对象引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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