constructor $this tcl tk

class ::classname{
   private variable m_device
   private variable m_label
   
   public method getLabel { device } {
   return $m_label($device)
   }

   public method getDevice { label } {
   return $m_device($label)
   }
 
   constructor { mapList } {
       puts "constructor $this"
        puts "list: $mapList"

        array set m_device [list]
        array set m_label [list]

        foreach {device label} $mapList {
            set m_device($label) $device
            set m_label($device) $label
        }
    }

    destructor {
        array unset m_device
        array unset m_label
    }
}


::classname  newclassnamevar args
  ##constructor $this  newclassnamevar = $this
  ##args    maplist = args

posted @ 2011-04-24 15:06  greencolor  阅读(197)  评论(0编辑  收藏  举报