diff options
Diffstat (limited to 'doc/class.n')
-rw-r--r-- | doc/class.n | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/doc/class.n b/doc/class.n index 02dfc46..ec06706 100644 --- a/doc/class.n +++ b/doc/class.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: class.n,v 1.1 2008/05/31 11:42:06 dkf Exp $ +'\" RCS: @(#) $Id: class.n,v 1.2 2008/10/17 10:22:25 dkf Exp $ '\" .so man.macros .TH class n 0.1 TclOO "TclOO Commands" @@ -24,8 +24,8 @@ package require TclOO \(-> \fBoo::class\fR .fi .BE - .SH DESCRIPTION +.PP The \fBoo::class\fR class is the class of all classes; every class is an instance of this class, which is consequently an instance of itself. This class is a subclass of \fBoo::object\fR, so every class is also an object. @@ -34,6 +34,7 @@ by subclassing \fBoo::class\fR. Note that the \fBoo::class\fR object hides the \fBnew\fR method on itself, so new classes should always be made using the \fBcreate\fR method. .SS CONSTRUCTOR +.PP The constructor of the \fBoo::class\fR class takes an optional argument which, if present, is sent to the \fBoo::define\fR command (along with the name of the newly-created class) to allow the class to be conveniently configured at @@ -65,6 +66,7 @@ the result of this method call. Note that this method is not exported by the \fBoo::class\fR object itself, so classes should not be created using this method. .SS "NON-EXPORTED METHODS" +.PP The \fBoo::class\fR class supports the following non-exported methods: .TP \fIobj \fBcreateWithNamespace\fI name nsName\fR ?\fIarg ...\fR? @@ -79,9 +81,11 @@ internal namespace will be \fInsName\fR unless that namespace already exists (i.e. returns a non-OK result) then the object is destroyed and the error message is the result of this method call. .SH EXAMPLES +.PP This example defines a simple class hierarchy and creates a new instance of it. It then invokes a method of the object before destroying the hierarchy and showing that the destruction is transitive. +.PP .CS \fBoo::class create\fR fruit { method eat {} { @@ -119,7 +123,6 @@ $b eat \fI\(-> error "unknown command"\fR oo::define(n), oo::object(n) .SH KEYWORDS class, metaclass, object - .\" Local variables: .\" mode: nroff .\" fill-column: 78 |