Chinaunix首页 | 论坛 | 博客
  • 博客访问: 26606
  • 博文数量: 19
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 187
  • 用 户 组: 普通用户
  • 注册时间: 2015-10-14 16:24
文章分类

全部博文(19)

文章存档

2015年(19)

我的朋友

分类: 系统运维

2015-11-17 20:31:16


点击(此处)折叠或打开

  1. class Person {
  2.         public variable name ""
  3.         public variable phone ""
  4.         public variable email ""

  5.         constructor {args} {
  6.             eval configure $args
  7.         }
  8.     }

This class has three public attributes: the person's name, phone number and e-mail address. Any extra args passed to the constructor are treated as configuration options and passed along to configure. A Person object can be created like this:

点击(此处)折叠或打开

  1. Person bob -name "Cyber Bob"
  2.         -phone "555-4bob"
  3.         -email "cbob@foo.com"

  4. and reconfigured like this:

  5.     bob configure
  6.      => {-email {} cbob@foo.com} {-name {} {Cyber Bob}} {-phone {} 555-4bob}

  7.     bob configure -phone
  8.      => -phone {} 555-4bob

  9.     bob configure -phone 1-800-num-4bob
  10.      =>

  11.     bob cget -phone
  12.      => 1-800-num-4bob

阅读(165) | 评论(0) | 转发(0) |
0

上一篇:Q-Dir 6.19

下一篇:format

给主人留下些什么吧!~~