Version 3 of oo::copy

Updated 2014-01-18 12:38:11 by dkf

Utility command that creates a duplicate of a TclOO object.

oo::copy sourceObject ?targetObject?

After duplication of the object structure itself, it calls an internal method of the created object, <cloned>, to allow it to set up any advanced properties of the created object based on the source object (which is passed as an argument). The default implementation of that method in the oo::object class copies procedures and variables from the source object's namespace, but does not copy any traces or commands implemented in C.

Note that objects can potentially refuse to be duplicated. This causes an error. Generating an error from the <cloned> method counts as refusal.

See also