summaryrefslogtreecommitdiffstats
path: root/doc/copy.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-05-31 11:41:59 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-05-31 11:41:59 (GMT)
commit5b6e0993e188fd16bbb2ec7f54b8b0c7be873629 (patch)
treeb68d9c4cbdbd0775c0419a152b70758bde998ca0 /doc/copy.n
parent032cdb06a8056b84ec16eaace0fc84044c95899a (diff)
downloadtcl-5b6e0993e188fd16bbb2ec7f54b8b0c7be873629.zip
tcl-5b6e0993e188fd16bbb2ec7f54b8b0c7be873629.tar.gz
tcl-5b6e0993e188fd16bbb2ec7f54b8b0c7be873629.tar.bz2
Implementation of TIP #257. Incomplete due to missing Win build support.
Diffstat (limited to 'doc/copy.n')
-rw-r--r--doc/copy.n54
1 files changed, 54 insertions, 0 deletions
diff --git a/doc/copy.n b/doc/copy.n
new file mode 100644
index 0000000..291d2fc
--- /dev/null
+++ b/doc/copy.n
@@ -0,0 +1,54 @@
+'\"
+'\" Copyright (c) 2007 Donal K. Fellows
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+'\" RCS: @(#) $Id: copy.n,v 1.1 2008/05/31 11:42:12 dkf Exp $
+'\"
+.so man.macros
+.TH copy n 0.1 TclOO "TclOO Commands"
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+oo::copy \- create copies of objects and classes
+.SH SYNOPSIS
+.nf
+package require TclOO
+
+\fBoo::copy\fI sourceObject \fR?\fItargetObject\fR?
+.fi
+.BE
+
+.SH DESCRIPTION
+The \fBoo::copy\fR command creates a copy of an object or class. It takes the
+name of the object or class to be copied, \fIsourceObject\fR, and optionally
+the name of the object or class to create, \fItargetObject\fR, which will be
+resolved relative to the current namespace if not an absolute qualified name.
+If \fItargetObject\fR is omitted, a new name is chosen. 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. The
+contents of the source object's private namespace \fIwill not\fR be copied; it
+is up to the caller to do this. The result of this command will be the
+fully-qualified name of the new object or class.
+.SH EXAMPLES
+This example creates an object, copies it, modifies the source object, and
+then demonstrates that the copied object is indeed a copy.
+.CS
+oo::object create src
+oo::define src method msg {} {puts foo}
+\fBoo::copy\fR src dst
+oo::define src method msg {} {puts bar}
+src msg \fI\(-> prints "bar"\fR
+dst msg \fI\(-> prints "foo"\fR
+.CE
+.SH "SEE ALSO"
+oo::class(n), oo::define(n), oo::object(n)
+.SH KEYWORDS
+clone, copy, duplication, object
+
+.\" Local variables:
+.\" mode: nroff
+.\" fill-column: 78
+.\" End: