singleton object

body DeviceObjectname::getObject {} {
   if {$m_theObject == {}} {
      #instantiate the singleton object
      set m_theObject [[namespace current] ::#auto]
   }
   return $m_theObject
}


singleton class cannot be directly instantiated. Use DeviceObjectname::getObject

原文地址:https://www.cnblogs.com/greencolor/p/2710326.html