ClassyTcl

  Class

Home    Documentation    Screenshots    Binary distributions    Source distribution   

The class named Class forms the basis of the ClassyTcl object system. It is the superclass of all classes and object in ClassyTcl. Class provides the functionality to produce classes and objects. Class will normally not be used by itself to create objects.

Classmethods

The classmethods defined by Class can be invoked from all classes.
ClassName new object ?...?
create a new instance (or object) with the name $object of class ClassName. When the actual object is created, the init method of class ClassName will be invoked with the arguments given after $object.
Usually, the init method of the superclass must be invoked somehere in the init method with appropriate parameters. This can be done using the command
super init ?...?
.
ClassName subclass SubClass
create a new class named $SubClass that inherits data and methods from class ClassName. ClassName is the parent or superclass of SubClass.
Classname destroy
destroys a class. All its instances and subclasses and their instances will also be destroyed. If the classmethod destroy if defined for the class, it will be invoked after the desctruction of its children, but before destroying the class itself and and its instances.
ClassName method name args body
define a new method named $name for class ClassName. Whenever the method is invoked, the contents of body will be executed. The arguments args and body follow the same conventions as in the Tcl command proc.
In body two extra local variables are available named class and object. They contain the name of respectively the class and the object that invoked the method. If the method was invoked from a class, the values of variables class and object will be identical (name of the class).
ClassName classmethod name args body
define a new classmethod named $name for class ClassName. Whenever the classmethod is invoked, the contents of body will be executed. The arguments args and body follow the same conventions as in the Tcl command proc.
In body two extra local variables are available named class and object. Because a classmethod can only be invoked from a class, they are both contain the name of the class that invoked the method.
ClassName deletemethod name
delete the method named $name from class ClassName. Some special methods cannot be deleted.
ClassName deleteclassmethod name
delete the classmethod named $name from class ClassName. Some special classmethods cannot be deleted.
ClassName private ?name? ?value?
classmethod private is used to get or change private data associated with a class. Without arguments a list of all private class variables is returned. If the name argument is given, but not the value argument, the current value of private class variable $name is returned. If both arguments are present, the private class variable $name is set to $value.

Methods

The methods defined by Class can be invoked from all objects
pathName destroy
destroys an object. The destroy method of the objects class (if defined) and those of its superclasses (if defined) will be invoked before the destruction of the actual object.
pathName info option ?...?
pathName info class
returns the class of pathName
pathName info classmethods ?pattern?
returns a list of all available classmethods except the hidden ones (those starting with an underscore is returned. When it is invoked with one argument, a list of all classmethods matching the pattern is returned
pathName info methods ?pattern?
returns a list of all available methods except the hidden methods (those starting with an underscore is returned. When it is invoked with one argument, a list of all methods matching the pattern is returned
pathName info parent
returns the parent of pathName
pathName info children
returns the children of pathName
pathName info subclasses
returns the subclasses pathName
pathName info classmethod option name ...
returns information about the classmethod $name of pathName. Following options are supported:
pathName info method option name ...
returns information about the method $name of pathName. It takes the same options as "info classmethod"
pathName private ?name? ?value?
private is used to get or change data associated with an object. Without arguments a list of all private variables is returned. If the name argument is given, but not the value argument, the current value of private variable $name is returned. If both arguments are present, the private variable $name is set to $value.
Peter De Rijk
hosted at SourceForge.net Logo