## Tcl8.6.17/Tk8.6.17 Documentation > Tcl Commands > my

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

### NAME

my — 現在の対象のどの手段でも起動する invoke any method of current object

### 構文 SYNOPSIS

package require TclOO
my methodName ?arg ...?

### 説明 DESCRIPTION

この my 命令は対象(又は級)のどの手段でも起動する為の対象の手段を許容する為に使われる｡特に､ methodName の為の適切な値の組は対象とその上位の組に適用されている全ての手段の組であり､移送されないものを含む｡その上の手段が起動される対象は常に､そこから my 命令が起動されている手段の現在の文脈の一つである(即ち self object に返された対象)｡ The my command is used to allow methods of objects to invoke any method of the object (or its class). In particular, the set of valid values for methodName is the set of all methods supported by an object and its superclasses, including those that are not exported. The object upon which the method is invoked is always the one that is the current context of the method (i.e. the object that is returned by self object) from which the my command is invoked.

それぞれの対象はそれ自身の my 命令を有し､その具現値名前空間内に含まれる｡ Each object has its own my command, contained in its instance namespace.

### 用例 EXAMPLES

この例は省略時設定では一般には不可視の oo::object 級の variables 手段を使う為の基本的な my の用法である: This example shows basic use of my to use the variables method of the oo::object class, which is not publicly visible by default:

    oo::class create c {
        method count {} {
            my variable counter
            puts [incr counter]
        }
    }
    c create o
    o count              → prints "1"
    o count              → prints "2"
    o count              → prints "3"

### SEE ALSO

next, oo::object, self

### KEYWORDS

method, method visibility, object, private method, public method
Copyright © 2007 Donal K. Fellows