Professional Documents
Culture Documents
Syntax Introduction: Jump To Navigationjump To Search Object Oriented TCL Network Simulator (Ns-2) Unix Xotcl
Syntax Introduction: Jump To Navigationjump To Search Object Oriented TCL Network Simulator (Ns-2) Unix Xotcl
Syntax Introduction[edit]
The reserved word Class is used to represent class and method of class are declared using
word instproc.[2] The variable self is pointer to the class it is used in and is equivalent to
variable this of C++/Java. The keyword -superclass is used for defining hierarchy.[2] For
example, Class Son -superclass Father means that class Son inherits from class Father. To
create an instance of class son we can write set new_inst [new Son]. Following is a simple
example of code.
Class HelloWorld
HelloWorld instproc hello {} {
puts "Hello world"
}
//to run
$helloworld hello
TclCL[edit]
TclCL (Tcl with classes) is a Tcl/C++ interface used by Mash, vic, vat, rtp_play, ns, and nam. It
provides a layer of C++ glue over OTcl.[3]