{"id":6242,"date":"2022-12-20T18:58:03","date_gmt":"2022-12-20T21:58:03","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/copy-mann\/"},"modified":"2022-12-20T18:58:03","modified_gmt":"2022-12-20T21:58:03","slug":"copy-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/copy-mann\/","title":{"rendered":"copy (mann)"},"content":{"rendered":"<h1 align=\"center\">copy<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">oo::copy \u2212 create copies of objects and classes<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">package require TclOO<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>oo::copy<\/b> <i>sourceObject<\/i> ?<i>targetObject<\/i>? ?<i>targetNamespace<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>oo::copy<\/b> command creates a copy of an object or class. It takes the name of the object or class to be copied, <i>sourceObject<\/i>, and optionally the name of the object or class to create, <i>targetObject<\/i>, which will be resolved relative to the current namespace if not an absolute qualified name and <i>targetNamespace<\/i> which is the name of the namespace that will <big>\u2502<\/big> hold the internal state of the object (<b>my<\/b> command, etc.); it <i>must not<\/i> <big>\u2502<\/big> refer to an existing namespace. If either <i>targetObject<\/i> or <big>\u2502<\/big> <i>targetNamespace<\/i> is omitted or is given as the empty string, a new name <big>\u2502<\/big> is chosen. Names, unless specified, are chosen with the same algorithm <big>\u2502<\/big> used by the <b>new<\/b> method of <b>oo::class<\/b>. The copied object will be of the same class as the source object, and will have all its per-object methods copied. If it is a class, it will also have all the class methods in the class copied, but it will not have any of its instances copied.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">After the <i>targetObject<\/i> has been created and all definitions of its <big>\u2502<\/big> configuration (e.g., methods, filters, mixins) copied, the <b><cloned><\/b> <big>\u2502<\/big> method of <i>targetObject<\/i> will be invoked, to allow for customization of <big>\u2502<\/big> the created object such as installing related variable traces. The only <big>\u2502<\/big> argument given will be <i>sourceObject<\/i>. The default implementation of this <big>\u2502<\/big> method (in <b>oo::object<\/b>) just copies the procedures and variables in the <big>\u2502<\/big> namespace of <i>sourceObject<\/i> to the namespace of <i>targetObject<\/i>. If this <big>\u2502<\/big> method call does not return a result that is successful (i.e., an error <big>\u2502<\/big> or other kind of exception) then the <i>targetObject<\/i> will be deleted and <big>\u2502<\/big> an error returned.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The result of the <b>oo::copy<\/b> command will be the fully-qualified name of the new object or class.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This example creates an object, copies it, modifies the source object, and then demonstrates that the copied object is indeed a copy.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">oo::object create src <br \/> oo::objdefine src method msg {} {puts foo} <b><br \/> oo::copy<\/b> src dst <br \/> oo::objdefine src method msg {} {puts bar} <br \/> src msg <i>\u2192 prints &#8220;bar&#8221;<\/i> <br \/> dst msg <i>\u2192 prints &#8220;foo&#8221;<\/i><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">oo::class(n), oo::define(n), oo::object(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">clone, copy, duplication, object<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  oo::copy \u2212 create copies of objects and classes <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2635,2861],"class_list":["post-6242","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-mann","tag-oo_copy"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6242"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6242\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}