1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
-
+
-
+
|
'\"
'\" Copyright (c) 2007 Donal K. Fellows
'\" Copyright (c) 2007-2008 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: object.n,v 1.1.2.2 2008/05/31 21:01:58 dgp Exp $
'\" RCS: @(#) $Id: object.n,v 1.1.2.3 2008/06/30 13:35:07 dgp Exp $
'\"
.so man.macros
.TH object n 0.1 TclOO "TclOO Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
oo::object \- root class of the class hierarchy
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
-
+
|
This method returns the globally qualified name of the variable \fIvarName\fR
in the unique namespace for the object \fIobj\fR.
.SH EXAMPLES
This example demonstrates basic use of an object.
.CS
set obj [\fBoo::object\fR new]
$obj foo \fI\(-> error "unknown method foo"\fR
oo::define $obj method foo {} {
oo::objdefine $obj method foo {} {
my \fBvariable\fR count
puts "bar[incr count]"
}
$obj foo \fI\(-> prints "bar1"\fR
$obj foo \fI\(-> prints "bar2"\fR
$obj variable count \fI\(-> error "unknown method variable"\fR
$obj \fBdestroy\fR
|