Body allows the code for a method to be created outside the
class definition (or to be replaced outside).
package require Itcl
itcl::class helloworld {
public variable owner "No-one"
method greet {} { puts "Hello World from $owner" }
}
helloworld h1
h1 configure -owner Me
h1 greet
# change the behaviour of helloworld
itcl::body helloworld::greet {} { puts "Goodbye Cruel World from $owner" }
h1 greet
Will use the original greet (Hello world...) up to the itcl::body command. Then greet is replaced.
Commonly used to prevent class definitions becoming too long to read - a long method should be placed outside the class definition as an itcl::body.
GWM