object



object

NAME
SYNOPSIS
CLASS HIERARCHY
DESCRIPTION
EXAMPLES
SEE ALSO
KEYWORDS

___________________________

NAME

oo::object − root class of the class hierarchy

SYNOPSIS

package require TclOO

oo::object method ?arg ...?

CLASS HIERARCHY

oo::object ___________________________

DESCRIPTION

The oo::object class is the root class of the object hierarchy; every object is an instance of this class. Since classes are themselves objects, they are instances of this class too. Objects are always referred to by their name, and may be renamed while maintaining their identity.

Instances of objects may be made with either the create or new methods of the oo::object object itself, or by invoking those methods on any of the subclass objects; see oo::class for more details. The configuration of individual objects (i.e., instance-specific methods, mixed-in classes, etc.) may be controlled with the oo::objdefine command.

Each object has a unique namespace associated with it, the instance namespace. This namespace holds all the instance variables of the object, and will be the current namespace whenever a method of the object is invoked (including a method of the class of the object). When the object is destroyed, its instance namespace is deleted. The instance namespace contains the object’s my command, which may be used to invoke non-exported methods of the object or to create a reference to the object for the purpose of invocation which persists across renamings of the object.

CONSTRUCTOR
The oo::object class does not define an explicit constructor.

DESTRUCTOR
The oo::object class does not define an explicit destructor.

EXPORTED METHODS
The oo::object class supports the following exported methods:
obj
destroy

This method destroys the object, obj, that it is invoked upon, invoking any destructors on the object’s class in the process. It is equivalent to using rename to delete the object command. The result of this method is always the empty string.

NON-EXPORTED METHODS
The oo::object class supports the following non-exported methods:
obj
eval ?arg ...?

This method concatenates the arguments, arg, as if with concat, and then evaluates the resulting script in the namespace that is uniquely associated with obj, returning the result of the evaluation.

obj unknown ?methodName? ?arg ...?

This method is called when an attempt to invoke the method methodName on object obj fails. The arguments that the user supplied to the method are given as arg arguments. If │ methodName is absent, the object was invoked with no method name │ at all (or any other arguments). The default implementation (i.e., the one defined by the oo::object class) generates a suitable error, detailing what methods the object supports given whether the object was invoked by its public name or through the my command.

obj variable ?varName ...?

This method arranges for each variable called varName to be linked from the object obj’s unique namespace into the caller’s context. Thus, if it is invoked from inside a procedure then the namespace variable in the object is linked to the local variable in the procedure. Each varName argument must not have any namespace separators in it. The result is the empty string.

obj varname varName

This method returns the globally qualified name of the variable varName in the unique namespace for the object obj.

obj <cloned> sourceObjectName

This method is used by the oo::object command to copy the state │ of one object to another. It is responsible for copying the │ procedures and variables of the namespace of the source object │ (sourceObjectName) to the current object. It does not copy any │ other types of commands or any traces on the variables; that can │ be added if desired by overriding this method in a subclass.

EXAMPLES

This example demonstrates basic use of an object.

set obj [oo::object new]
$obj foo → error "unknown method foo"
oo::objdefine $obj method foo {} {
my variable count
puts "bar[incr count]"
}
$obj foo → prints "bar1"
$obj foo → prints "bar2"
$obj variable count → error "unknown method variable"
$obj destroy
$obj foo → error "unknown command obj"

SEE ALSO

my(n), oo::class(n)

KEYWORDS

base class, class, object, root class




More Linux Commands

manpages/gnutls_x509_trust_list_verify_named_crt.3.html
gnutls_x509_trust_list_verify_named_crt(3) - API function...
This function will try to find a matching named certificate. If a match is found the certificate is considered valid. In addition to that this function will als

manpages/Tcl_UniCharIsAlpha.3.html
Tcl_UniCharIsAlpha(3) - routines for classification of Tcl_U
All of the routines described examine Tcl_UniChars and return a boolean value. A non-zero return value means that the character does belong to the character cla

manpages/XWriteBitmapFile.3.html
XWriteBitmapFile(3) - manipulate bitmaps - Linux man page...
The XReadBitmapFile function reads in a file containing a bitmap. The file is parsed in the encoding of the current locale. The ability to read other than the s

manpages/rmdir.1.html
rmdir(1) - remove empty directories - Linux manual page.....
Remove the DIRECTORY(ies), if they are empty. --ignore-fail-on-non-empty ignore each failure that is solely because a directory is non-empty -p, --parents remov

manpages/isupper.3.html
isupper(3) - character classification routines (Man Page)...
These functions check whether c, which must have the value of an unsigned char or EOF, falls into a certain character class according to the specified locale. T

manpages/pnmtopclxl.1.html
pnmtopclxl(1) - convert a PNM image to an HP LaserJet PCL XL
This program is part of Netpbm(1) pnmtopclxl reads one or more PNM input streams, each containing one or more PNM images, and generates a sequence of output pag

manpages/getutmp.3.html
getutmp(3) - copy utmp structure to utmpx, and vice versa...
The getutmp() function copies the fields of the utmpx structure pointed to by ux to the corresponding fields of the utmp structure pointed to by u. The getutmpx

manpages/numastat.8.html
numastat(8) - Print statistics about NUMA memory allocation
numastat with no command options or arguments at all, displays per-node NUMA hit and miss system statistics from the kernel memory allocator. This default numas

manpages/glTexCoord1fv.3gl.html
glTexCoord1fv(3gl) - set the current texture coordinates....
glTexCoord specifies texture coordinates in one, two, three, or four dimensions. glTexCoord1 sets the current texture coordinates to (s, 0, 0, 1); a call to glT

manpages/Tk_GetMMFromObj.3.html
Tk_GetMMFromObj(3) - translate between strings and screen un
These procedures take as argument a specification of distance on the screen (objPtr or string) and compute the corresponding distance either in integer pixels o

manpages/ps2ascii.1.html
ps2ascii(1) - Ghostscript translator from PostScript or PDF
ps2ascii uses gs(1) to extract ASCII text from PostScript(tm) or Adobe Portable Document Format (PDF) files. If no files are specified on the command line, gs r

manpages/timerfd_gettime.2.html
timerfd_gettime(2) - timers that notify via file descriptors
These system calls create and operate on a timer that delivers timer expiration notifications via a file descriptor. They provide an alternative to the use of s





We can't live, work or learn in freedom unless the software we use is free.