![]() |
![]()
| ![]() |
![]()
NAMEoo::object - root class of the class hierarchy SYNOPSISpackage require tcl::oo oo::object method ?arg ...? CLASS HIERARCHYoo::object DESCRIPTIONThe 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. CONSTRUCTORThe oo::object class does not define an explicit constructor. DESTRUCTORThe oo::object class does not define an explicit destructor. EXPORTED METHODSThe oo::object class supports the following exported methods:
NON-EXPORTED METHODSThe oo::object class supports the following non-exported methods:
Note that object-internal commands such as my and self can be invoked in this context.
EXAMPLESThis example demonstrates basic use of an object. set obj [oo::object new] $obj foo → error "unknown method foo" oo::objdefine $obj method foo {} { SEE ALSOmy(n), oo::class(n) KEYWORDSbase class, class, object, root class
|