Hi,<br><br>I have a junior question when using collection to store/get my own defined element.<br>My elements is defined as below:<br><br>Object subclass: #MyItem<br>&nbsp;&nbsp;&nbsp; instanceVariableNames: &#39;subItems&#39;<br>&nbsp;&nbsp;&nbsp; classVariableNames: &#39;&#39;
<br>&nbsp;&nbsp;&nbsp; poolDictionaries: &#39;&#39;<br>&nbsp;&nbsp;&nbsp; category: &#39;MyTest&#39;<br><br><br>Where the subItems instance var is also a collection.<br><br>But I don&#39;t know how to store/get such kind of MyItem by using collection, I think I need deep copy an element when add it to the collection.
<br><br>I don&#39;t think the following code works.<br><br>|temp coll|<br>temp := MyItem new.<br>temp addSubItem: &#39;hello&#39;; addSubItem &#39;world&#39;; yourself.<br>coll := OrderedCollection new.<br>coll add: temp<br>
<br>How can I add the deep copied element to my collection and retrieve it later? shall I overload the #copy method?<br><br>Best regards and thanks<br>-Xinyu<br>