How is 'clone' implemented?
Mario Wolczko
Mario.Wolczko at Eng.Sun.COM
Thu Nov 30 03:09:04 UTC 1995
How is 'clone', which as I understand all objects inherit from
the root object, implemented? Spefically, does it perform a
shallow or a deep copy of the slots in the receiver... I would
assume a deep one of some sorts or else the clones wouldn't be
too usable. But what mechanism is then used to prevent clone
from recursing to 'parent' via the slot of that name? How about
other slots with non-primitive objects?
Clone is a primitive applicable to (almost) all objects, and it makes
a shallow copy. If an object needs a deeper copy, it has to
explicitly clone sub-objects.
More information about the Self-interest
mailing list