

package require TclOO

oo::class create ComponentSet {

    constructor {} {
        my variable mChildren
        set mChildren {}
    }
    destructor {
        my variable mChildren
        foreach child $mChildren {
            $child destroy
        }
    }
    method add {child} {
        my variable mChildren
        lappend mChildren $child
    }
    method refresh {} {
        my variable mChildren
        foreach child $mChildren {
            $child refresh
        }
    }
}

oo::class create ComponentChild {
    method refresh {} {
    }
}


set M [ComponentSet create M]
for {set i 0} {$i < 10} {incr i} {
    $M add [set C [ComponentSet new]]
    for {set j 0} {$j < 5} {incr j} {
        $C add [ComponentChild new]
    }
}


