OTcl
From Wikipedia, the free encyclopedia
OTcl is an Object oriented extension of Tcl and created by David Wetherall[1]. It is used in network simulator (NS-2) and usually run under Unix environment[2]
[edit] Syntax Introduction
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 -instproc is used for defining hierarchy.[2] For example Class Son -instproc 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.
// Sample code in OTcl Class HelloWorld HelloWorld instproc hello {} { puts "Hello world" } set helloworld [new HelloWorld] //to run $helloworld hello
[edit] References
- ^ OTcl Project Page
- ^ a b c Sophie-Antipolis NS Simulator for beginners, Lecture notes, 2003-2004, Univ. de Los Andres, Merida, Venezuela and ESSI