View · Index

Methods for classes

Since classes are Objects, one can define class-specific methods (similar to static methods in C++/Java) with the same method as object-specific methods (via "proc")

Class Stack
# ...
Stack proc available_stacks {} {
   return [llength [my info instances]]
}

Stack s1
Stack s2

puts [Stack available_stacks]