Caveat: This overview does not attempt to provide an introduction to object orientation.

Object Tcl is a standard Tcl extension package that makes it possible to use object oriented programming concepts from within Tcl and, if required, provides a tight object oriented coupling to C++.

From the Tcl perspective, Object Tcl provides additional commands to support the description of classes of objects, along with attributes and methods, and manipulation of those classes. The concepts introduced into Tcl are:

In Object Tcl, a class description contains details of its behaviors, via methods, and state, via attributes. Object Tcl classes may have methods and attributes that have class scope or object scope.

Object Tcl classes may inherit from other classes, described in Object Tcl or C++, as a way of structuring and reusing common code. Both single and multiple inheritance is available.

Object Tcl classes may be instantiated to create objects of that class. The instantiation of a class results in an object reference that may be used to invoke methods upon the object. Finally, objects may be discarded.

A primary objective of Object Tcl is to support the reuse of classes that are described in C++. Object Tcl makes it possible to create new classes in Tcl that inherit from C++ classes. The dynamic binding of virtual methods crosses the boundary from Tcl to C++ and, if the method is called on the object from C++, will cross over into Tcl if the method is defined in the Tcl subclass.

The tight coupling to C++ makes it possible to build a class hierarchy or framework in C++ that can then be extended using the interpreted Tcl language.

Object Tcl | Overview | Language Reference | C++ Binding Reference | Example | Source Code

otcl@x.co.uk

Return to Welcome Home Page or Continue to Browse