[Class] of all classes in [TclOO]. All classes are instances of this class (which is consequently an instance of itself!) === ‣ [oo::object] ‣ [oo::class] === http://www.tcl.tk/man/tcl8.6/TclCmd/class.htm ---- [AMG]: Is there a compelling reason why [[oo::class new]] is hidden? [DKF]: Because everyone treats classes as named entities with long lifetimes. Expose it if you want. [AMG]: How do I do this? Sorry, I'm a total [TclOO] newb. :^) ---- [AMG]: Can I define a destructor for a class? Automatically deleting all subclasses, instances, and "mixees" is good, but I'm working on a project that needs some additional cleanup when a class is destroyed. [DKF]: Yes. The simplest technique is to make your class an instance of a subclass of `oo::class` and attach the destructor to that. ====== oo::class create class-with-destructor { superclass oo::class destructor { puts "bye!" } } class-with-destructor create MyClass { # ... } ====== But if you've already got your class instance, do not despair! You can either inject the destructor through a mixin or by modifying the class instance's superclass (both with [oo::objdefine]): ====== # Technique 1 oo::objdefine MyClass mixin class-with-destructor # Technique 2 oo::objdefine MyClass class class-with-destructor ====== If you're changing objects' classes, remember that classes cannot be changed to non-classes or ''vice versa'', and both [oo::object] and `oo::class` cannot have their class changed (they're special, for the sake of sanity). [AMG]: Wait a second, according to [http://www.tcl.tk/man/tcl8.6/TclCmd/define.htm#M8], "the destructor is called when objects of the class are deleted". I want a destructor for when the class itself is deleted. ---- See also: * [Semantics of the oo::class command] <> Object Orientation