In
object orientation, a
class is a template for creating
objects.
Description edit
A
class may declare which data elements can exist in a class and what their types must be, and it may also specify and even implement functions that apply to those data elements. Depending on the
object system, a class may also specify how an
instance is to be created and/or destroyed, how
methods should be dispatched, what methods can exist in a class, etc. In dynamic languages like
Tcl, what an
object system does with a class is more flexible than, e.g.,
C++, which is more constrained by its static nature.
DKF: I like to think of a class as being the
type of one or more
objects, as well as a
[factory
] for those objects. Not all OO systems uses classes though (e.g.
Self uses prototypical objects).
incr tcl class command edit
The string "class" is also used as an extension command name, at least within
itcl.
See Also edit
- a class code generator