oo::object

oo::object , a built-in Tcl command, is the root class of all objects in TclOO.

Documentation

official reference

<cloned> Method that Respects Imported Procedures

oo::object <cloned> copies aliased procedures in the origin namespace over to the new namespace as native procedures. The following method can be added to an object or a oo::class, overriding oo::object <cloned> and providing for imported procedures to end up as imported procedures in the new namespace as well.

method <cloned> sourceObject {
    set fromns [info object namespace $sourceObject]
    set myns [self namespace]
    foreach varname [info vars ${fromns}::*] {
        set tail [namespace tail $varname]
        set ${myns}::$tail [set $varname]
    }
    #copycommands is from https://wiki.tcl-lang.org/1489
    [info object namespace $sourceObject]::copycommands $fromns [
        self namespace] my
}