Name
class
- class
className definition
Define a new class named
className
. The properties of the class are described bydefinition
, 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 listargs
and code bodybody
. 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 listargs
and code bodybody
. 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 stringinit
supplies an initial value for the variable when the object is created. Optional scriptconfig
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 stringinit
supplies a value for the variable to be initialized with whenever a new object is ...
Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.