1my(n) TclOO Commands my(n)
2
3
4
5______________________________________________________________________________
6
8 my - invoke any method of current object
9
11 package require TclOO
12
13 my methodName ?arg ...?
14______________________________________________________________________________
15
17 The my command is used to allow methods of objects to invoke any method
18 of the object (or its class). In particular, the set of valid values
19 for methodName is the set of all methods supported by an object and its
20 superclasses, including those that are not exported. The object upon
21 which the method is invoked is always the one that is the current con‐
22 text of the method (i.e. the object that is returned by self object)
23 from which the my command is invoked.
24
25 Each object has its own my command, contained in its instance names‐
26 pace.
27
29 This example shows basic use of my to use the variables method of the
30 oo::object class, which is not publicly visible by default:
31
32 oo::class create c {
33 method count {} {
34 my variable counter
35 puts [incr counter]
36 }
37 }
38 c create o
39 o count → prints "1"
40 o count → prints "2"
41 o count → prints "3"
42
44 next(n), oo::object(n), self(n)
45
47 method, method visibility, object, private method, public method
48
49
50
51
52TclOO 0.1 my(n)