| Creating Tcl Objects in C/C++ |
|
|
Object action families, such as those associated with Tk widgets or Tcl interpreters, are a form of object-orientation that is available in Tcl. For the Tcl/Tk programmer, this form of object orientation is a little like being able to use some C++ classes without being able to implement any such classes. This chapter is about how to implement such classes. This is something you need the C/C++ connection to accomplish. The chapter begins with a discussion of object orientation in C rather than C++. This is because it is C's form of object orientation that supports that of Tcl. The chapter continues with an example that extends Tcl with a stack data type. Not everything that is objectlike should be implemented as
an object. This is because some objectlike entities
reproduce often and have short lives. Such entities have
been called The final section considers situations in which commands must work with multiple objects at once. These situations can be handled with either objects or flyweight objects. This happens to be the section in which the implementation of flyweight objects is described. The example extends Tcl with a vector data type. All of the major examples in this section could be string-based or object-based. However, only the flyweight vectors are shown both ways. The other two major examples are one of each. Remark
|
Author's Home Page |
|
Order from Amazon. |