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