Name

class

class className definition

Define a new class named className. The properties of the class are described by definition, a list containing any of the following Tcl statements:

inherit [baseClass...]

Cause class to inherit characteristics from one or more existing base classes.

constructor args [init] body

Define the argument list and body for the constructor method called when an object is created. Can optionally specify init statement to pass parameters to base class constructors. Constructor always returns the class name.

destructor body

Define the code body for the destructor method called when an object is deleted.

method name [args] [body]

Declare a method named name. Can define the argument list args and code body body. The body command can define or redefine the method body outside of the class definition.

proc name [args] [body]

Declare a procedure named name. Can define the argument list args and code body body. The body command can define or redefine the body outside of the class definition.

variable varName [init] [config]

Define an object-specific variable named varName. Optional string init supplies an initial value for the variable when the object is created. Optional script config specifies code to be executed whenever a public variable is modified using the configure command.

common varName [init]

Declare a common variable (shared by all class objects) named varName. Optional string init supplies a value for the variable to be initialized with whenever a new object is created.

public command [arg...]

Declares that the element defined by command is to be publicly accessible (i.e., accessible from any namespace). The parameter command can be any of the subcommands method, proc, variable, common, or a script containing several member definitions.

protected command [arg...]

Declares that the element defined by command is to have protected access (i.e., accessible from the same class namespace and any namespaces nested within it).

private command [arg...]

Declares that the element defined by command is to have private access (i.e., accessible only from the same class namespace).

set varName [value]

Set the initial value of a variable or common variable.

array option [arg...]

A standard Tcl array command can be used within a class definition, typically to initialize variables.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset