Posted to tcl by aspect at Mon Nov 09 03:13:10 GMT 2015view raw
- oo::class create Light {
- method blink {} {
- puts "[self class] [self] blinking!"
- }
- }
- oo::class create Fitting {
- variable nLights
- constructor {} {
- Light create Spot
- oo::objdefine [self] forward spot Spot
- }
- method addLight {} {
- Light create lamp[incr nLights]
- oo::objdefine [self] forward light$nLights lamp$nLights
- }
- method light {n args} {
- lamp$n {*}$args
- }
- method lights {args} {
- for {set n 1} {$n <= $nLights} {incr n} {
- my light$n {*}$args
- }
- }
- }
- Fitting create strip
- strip addLight
- strip addLight
- strip light 1 blink
- strip light2 blink
- strip lights blink