tclprivateincr-tcl

Why I can't set the common variable a property to be private or public?


In TCL's Itcl package there is a way to define a class and static members for that class using common keyword. But I have never seen that common variable was declared as private or public? Can we do that? If no, then why?


Solution

  • The document for itcl stated that the keywords { private, public, protected } can be placed in front of { method, proc, variable or common } so the answer is yes, we can do that.

    Reference: http://www.tcl.tk/man/itcl3.1/class.n.html