[Newbies] How to deep copy elements when using collectons?
Keith Hodges
keith_hodges at yahoo.co.uk
Wed Jan 2 06:50:53 UTC 2008
To modify the behaviour of copy to be more appropriate for your class,
the facility is provided via #postCopy.
The basic copy implementation is as follows.
copy
^ self shallowCopy postCopy
specializing #postCopy for your class, it can perfrom further copies of
its inst vars if needed.
postCopy
instVarWithCollection := instVar withCollection copy.
So now the collection is a different collection although it contains the
same elements.
best regards
Keith
More information about the Beginners
mailing list