⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 local.n

📁 这是一个Linux下的集成开发环境
💻 N
字号:
'\"'\" Copyright (c) 1993-1998  Lucent Technologies, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\"'\" RCS: $Id: local.n,v 1.1 2003/02/05 10:53:53 mdejong Exp $'\".so man.macros.TH local n "" itcl "[incr\ Tcl]".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMElocal \- create an object local to a procedure.SH SYNOPSIS\fBlocal \fIclassName objName\fR ?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPThe \fBlocal\fR command creates an \fB[incr\ Tcl]\fR object thatis local to the current call frame.  When the call frame goes away,the object is automatically deleted.  This command is useful forcreating objects that are local to a procedure..PPAs a side effect, this command creates a variable named"\fCitcl-local-\fIxxx\fR", where \fIxxx\fR is the name ofthe object that is created.  This variable detects when thecall frame is destroyed and automatically deletes theassociated object..SH EXAMPLEIn the following example, a simple "counter" object is usedwithin the procedure "test".  The counter is created as alocal object, so it is automatically deleted each time theprocedure exits.  The \fBputs\fR statements included in theconstructor/destructor show the object coming and goingas the procedure is called..CSclass counter {    private variable count 0    constructor {} {        puts "created: $this"    }    destructor {        puts "deleted: $this"    }    method bump {{by 1}} {        incr count $by    }    method get {} {        return $count    }}proc test {val} {    local counter x    for {set i 0} {$i < $val} {incr i} {        x bump    }    return [x get]}set result [test 5]puts "test: $result"set result [test 10]puts "test: $result"puts "objects: [info objects]".CE.SH KEYWORDSclass, object, procedure

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -