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> instanceVariableNames: 'subItems'<br> classVariableNames: ''
<br> poolDictionaries: ''<br> category: 'MyTest'<br><br><br>Where the subItems instance var is also a collection.<br><br>But I don'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't think the following code works.<br><br>|temp coll|<br>temp := MyItem new.<br>temp addSubItem: 'hello'; addSubItem 'world'; 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>