使用incr-tcl进行OO编程
1. 进行incr-tcl的编译, 下载incr-tcl包。
http://ncu.dl.sourceforge.net/project/incrtcl/%5BIncr%20Tcl_Tk%5D-source/3.4/itcl3.4b1.tar.gz
2. Build
# make && make install && make test
...
3. 创建一个简单的类,然后执行:
# ./oo.tcl
Hello, world
1 #!/usr/bin/tclsh
2
3 package require Itcl
4
5 itcl::class foo {
6 constructor {} {
7 }
8
9 destructor {
10 }
11
12 method test {} {
13 puts "Hello, world"
14 }
15 }
16
17 foo aa
18
19 aa test
|
阅读(1426) | 评论(0) | 转发(0) |